Eugene Zhulenev via llvm-dev
2020-Apr-18 05:58 UTC
[llvm-dev] PerfJITEventListener needs perf-<pid>.map?
I'm trying to use PerfJITEventListener with llvm::orc::LLJITBuilder: 1. perf record -o /tmp/perf.data -- <my_binary_with_event_listener> 2. perf inject -j -v -i /tmp/perf.data -o /tmp/perf.data.jit *jit marker found: ~.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump* *injecting: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump* *write ELF image ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-1.so* *write ELF image ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-2.so* *injected: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump (0)* Generated ELF files have correct .text sections. However perf report can't find these generated so files: + 69.50% 23.82% my_binary [JIT] tid 149849 [.] 0x00007f9c34d5106a + 51.78% 45.69% my_binary [JIT] tid 149849 [.] 0x00007f9c34d51065 + 27.71% 6.09% my_binary [JIT] tid 149849 [.] 0x00007f9c34d51060 It seems that perf report is looking for a shared object in /tmp/perf-149849.map, but that file doesn't exist. Looking at examples in the original LLVM change ( https://reviews.llvm.org/D44892?), I don't see any mentions of perf.map file. Do I miss something? Are there any examples of how to use perf listener? Thanks, Eugene -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200417/bc8499e9/attachment.html>
Eugene Zhulenev via llvm-dev
2020-Apr-18 08:19 UTC
[llvm-dev] PerfJITEventListener needs perf-<pid>.map?
Figured out how to make it work, thanks to example in https://reviews.llvm.org/rG39253a50f0f33e491e2d021f94cd3a87ee773f2d *auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>(* * session, []() { return std::make_unique<SectionMemoryManager>(); });* *objectLayer->registerJITEventListener(*llvm::JITEventListener::createPerfJITEventListener());* Previously I was forwarding to JITEventListener::notifyObjectLoaded from objectLayer->setNotifyLoaded callback. Eugene On Fri, Apr 17, 2020 at 10:58 PM Eugene Zhulenev <ezhulenev at google.com> wrote:> I'm trying to use PerfJITEventListener with llvm::orc::LLJITBuilder: > > 1. perf record -o /tmp/perf.data -- <my_binary_with_event_listener> > 2. perf inject -j -v -i /tmp/perf.data -o /tmp/perf.data.jit > > *jit marker found: ~.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump* > *injecting: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump* > *write ELF image > ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-1.so* > *write ELF image > ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-2.so* > *injected: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump (0)* > > > Generated ELF files have correct .text sections. > > However perf report can't find these generated so files: > > + 69.50% 23.82% my_binary [JIT] tid 149849 [.] 0x00007f9c34d5106a > + 51.78% 45.69% my_binary [JIT] tid 149849 [.] 0x00007f9c34d51065 > + 27.71% 6.09% my_binary [JIT] tid 149849 [.] > 0x00007f9c34d51060 > > It seems that perf report is looking for a shared object > in /tmp/perf-149849.map, but that file doesn't exist. > > Looking at examples in the original LLVM change ( > https://reviews.llvm.org/D44892?), I don't see any mentions of perf.map > file. > > Do I miss something? Are there any examples of how to use perf listener? > > Thanks, > Eugene >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200418/f7c04df2/attachment.html>
Owen Anderson via llvm-dev
2020-Apr-29 18:42 UTC
[llvm-dev] PerfJITEventListener needs perf-<pid>.map?
Hi Eugene, Did you ever discover the root cause of this problem? I seeing the same symptoms when using MCJIT. --Owen> On Apr 18, 2020, at 1:19 AM, Eugene Zhulenev via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Figured out how to make it work, thanks to example in https://reviews.llvm.org/rG39253a50f0f33e491e2d021f94cd3a87ee773f2d <https://reviews.llvm.org/rG39253a50f0f33e491e2d021f94cd3a87ee773f2d> > > auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>( > session, []() { return std::make_unique<SectionMemoryManager>(); }); > objectLayer->registerJITEventListener(*llvm::JITEventListener::createPerfJITEventListener()); > > Previously I was forwarding to JITEventListener::notifyObjectLoaded from objectLayer->setNotifyLoaded callback. > > Eugene > > On Fri, Apr 17, 2020 at 10:58 PM Eugene Zhulenev <ezhulenev at google.com <mailto:ezhulenev at google.com>> wrote: > I'm trying to use PerfJITEventListener with llvm::orc::LLJITBuilder: > > 1. perf record -o /tmp/perf.data -- <my_binary_with_event_listener> > 2. perf inject -j -v -i /tmp/perf.data -o /tmp/perf.data.jit > > jit marker found: ~.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump > injecting: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump > write ELF image ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-1.so > write ELF image ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jitted-149849-2.so > injected: ~/.debug/jit/llvm-IR-jit-20200417-3c2242/jit-149849.dump (0) > > Generated ELF files have correct .text sections. > > However perf report can't find these generated so files: > > + 69.50% 23.82% my_binary [JIT] tid 149849 [.] 0x00007f9c34d5106a > + 51.78% 45.69% my_binary [JIT] tid 149849 [.] 0x00007f9c34d51065 > + 27.71% 6.09% my_binary [JIT] tid 149849 [.] 0x00007f9c34d51060 > > It seems that perf report is looking for a shared object in /tmp/perf-149849.map, but that file doesn't exist. > > Looking at examples in the original LLVM change (https://reviews.llvm.org/D44892? <https://reviews.llvm.org/D44892?>), I don't see any mentions of perf.map file. > > Do I miss something? Are there any examples of how to use perf listener? > > Thanks, > Eugene > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200429/0a283dbd/attachment.html>