Page MenuHomeFreeBSD

pmcstat: add support for generating perf script data files for llvm-profgen
Needs ReviewPublic

Authored by pfg on Fri, Sep 4, 4:02 AM.
Tags
None
Referenced Files
F171221629: D59383.diff
Wed, Sep 9, 3:13 PM
F171180629: D59383.id185796.diff
Wed, Sep 9, 7:33 AM
Unknown Object (File)
Tue, Sep 8, 6:30 AM
Unknown Object (File)
Mon, Sep 7, 4:10 PM
Unknown Object (File)
Mon, Sep 7, 1:01 PM
Unknown Object (File)
Sun, Sep 6, 2:42 AM
Unknown Object (File)
Sun, Sep 6, 2:39 AM
Unknown Object (File)
Sun, Sep 6, 2:39 AM
Subscribers

Details

Summary

Both GCC and clang offer the option of generating code that is optimized
with CPU programming counter data by tools like Linux perf or FreeBSD
pmc(3).

With Linux perf, the recommendation is to use the -b flag to use the
Last Branch Record (LBR) to record call chains: on FreeBSD, enhance the
pmcstat(8) tool with a new -B option that generates a similar profile.

hwpmc sample

│
├── timestamp ───────→ perf-script timestamp
├── PID ──────────────→ PID
├── CPU ──────────────→ CPU
├── PMC ──────────────→ event name
├── PC ───────────────→ IP/callchain
└── process mappings ─→ MMAP2
Test Plan

pmcstat -B profile.perf
llvm-profgen --perfscript=profile.perf ...

If llvm-profgen accepts this and llvm-profdata show demonstrates meaningful function/inline-context sample counts, then the proposal has achieved its essential goal with a surprisingly small FreeBSD change

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped