[llvm-dev] How to correctly use PerfJITEventListener?

Frank Tetzel via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 15 05:09:53 PST 2019


I'm struggling to get PerfJITEventListener to work. It was already fun
to find out that I need to enable LLVM_USE_PERF in cmake during
compilation, and that the jitdump files are stored in ~/.debug/jit/ by
default. But it's still not working.

The steps I do:

1. Get event listener with JITEventListener::createPerfJITEventListener
2. In NotifyLoadedFunction passed to orc::RTDyldObjectLinkingLayer ctor
   pass object and info to event listener's NotifyObjectEmitted

Then, I profile the application with:
perf record -k 1 ./app

This generates a jit-*.dump file in ~/.debug/jit/llvm-IR-jit-*/.

Inject the events into the perf data
perf inject -j -i perf.data -o perf.data.jitted

This creates jitted-*.so files in ~/.debug/jit/llvm-IR-jit-*/ for each
JIT compiled function.

Finally, I open the profile report:
perf report -i perf.data.jitted

But here is the problem. The JIT compiled functions are not "resolved".
I cannot "zoom in" to the code and annotate the instructions with
profile information.

Am I missing something here? Is there a small example somewhere which
uses PerfJITEventListener with ORC?

Best regards,

More information about the llvm-dev mailing list