[llvm-commits] Initial OProfile symbolization support
Jeffrey Yasskin
jyasskin at google.com
Mon Jun 29 15:32:04 PDT 2009
OProfile provides a library to tell it about JIT output, described at
http://oprofile.sourceforge.net/doc/devel/jit-interface.html. This
patch tells OProfile about function ranges, but not line numbers. It
adds a --with-oprofile=<prefix> flag to configure, but I don't know
how to do the equivalent to cmake.
Problems:
1. Because oprofile installs its libraries to <prefix>/lib/oprofile,
we need an -rpath option to let the loader find them. We could
probably link the oprofile library statically to avoid this (but
how?).
2. llvm-config doesn't include the required -L and -rpath flags in its
--ldflags output, even though it includes -lopagent.
3. cmake support is missing, as mentioned above.
I've tested this by running the attached fib.c under lli. Let me know
if you can think of an automated way to test it.
The output from opreport follows:
Before:
$ opreport -l ~/opensource/llvm/trunk/dbg/Debug/bin/lli
CPU: Core 2, speed 1998 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask
of 0x00 (Unhalted core cycles) count 100000
samples % image name symbol name
48182 98.9729 anon (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000) anon
(tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000)
11 0.0226 libstdc++.so.6.0.9 /usr/lib/libstdc++.so.6.0.9
10 0.0205 lli llvm::MachineOperand::isReg() const
...
After:
$ opreport -l ~/opensource/llvm/oprof/dbg/Debug/bin/lli
CPU: Core 2, speed 1998 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask
of 0x00 (Unhalted core cycles) count 100000
samples % image name symbol name
24565 60.7308 19814.jo fib_left
15365 37.9861 19814.jo fib_right
22 0.0544 ld-2.7.so do_lookup_x
10 0.0247 lli llvm::MachineOperand::isReg() const
8 0.0198 ld-2.7.so _dl_relocate_object
8 0.0198 lli std::vector<llvm::MachineOperand,
std::allocator<llvm::MachineOperand> >::size() const
...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oprofile.patch
Type: text/x-patch
Size: 7685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090629/15c69b27/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fib.c
Type: text/x-csrc
Size: 1014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090629/15c69b27/attachment.c>
More information about the llvm-commits
mailing list