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
Unknown Object (File)
Tue, Sep 29, 5:05 PM
Unknown Object (File)
Wed, Sep 23, 10:33 PM
Unknown Object (File)
Wed, Sep 23, 10:33 PM
Unknown Object (File)
Wed, Sep 23, 3:23 AM
Unknown Object (File)
Tue, Sep 22, 8:20 PM
Unknown Object (File)
Sun, Sep 20, 3:39 PM
Unknown Object (File)
Sun, Sep 20, 3:25 PM
Unknown Object (File)
Sun, Sep 20, 3:25 PM
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