https://sourceware.org/bugzilla/show_bug.cgi?id=33172
Bug ID: 33172 Summary: RFE: eu-stacktrace adjacent tool to generate sampled call-graph profile info Product: elfutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: tools Assignee: unassigned at sourceware dot org Reporter: fche at redhat dot com CC: elfutils-devel at sourceware dot org Target Milestone: --- There is the need for a *lightweight* (in terms of usage complexity, build dependency) tool that generates dynamic callgraph profiles of uninstrumented programs, in a format that linkers can use to guide PGO optimization. (There are other uses for this sort of data, such as compiler LTO.) The format I propose is the llvm sampled profile text format as accepted by llvm-profdata and lld, and generated by autofdo's create_llvm_prof. Conceptually it's kinda sorta similar to "gprof -b", but lacking basic-block level edge data one would get from instrumentation. "gprofng" may be arm-twisted into producing such a report too, maybe. (On the production side, sediment and llvm-prof-gen on the other hand presuppose LBR perfctr hardware instead of unwinding, so unhelpful on much hardware.) One such file would have to be output for each binary of interest (i.e., separate for solibs). I imagine the tool invoking some default set of perfctr events (sth. like "perf record --call-graph $SOMETHING -c $COUNT -e branches" and optional extra events), and piping the data into eu-stacktrace's unwinder. For each perf record, it'd need to do only a couple of rounds of unwinding, just enough to get through inlining and out to a normal function. The data then needs to be turned to symbols (mangled function names; ideally also source-level function-definition-relative line numbers of the pc addresses), tabulated in a tree, then eventually printed. (It may be possible to prototype it in systemtap.) https://github.com/google/autofdo/blob/master/testdata/callgraph_with_cycles.txt https://sourceware.org/pipermail/binutils/2025-July/142644.html https://x.com/i/grok/share/1gPL7JSBCimEn9rFPr6Ze4Tlh [format description] -- You are receiving this mail because: You are on the CC list for the bug.