Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1111)

Issue 89041: Initial OProfile symbolization support (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 10 months ago by Jeffrey Yasskin
Modified:
14 years, 9 months ago
Reviewers:
Base URL:
http://llvm.org/svn/llvm-project/llvm/trunk/
Visibility:
Public.

Description

Mailed to http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090629/079752.html 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. 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 following fib.c under lli. Let me know if you can think of an automated way to test it. ---------------- $ cat fib.c /* Use this to test oprofile support. Some useful command lines are: # To get per-app stats: sudo opcontrol --separate=library clang -g fib.c -o fib sudo opcontrol --reset; sudo opcontrol --start-daemon; sudo opcontrol --start; ./fib; sudo opcontrol --stop opreport -g -d -l ./fib|less clang -g fib.c -c -emit-llvm -o fib.bc sudo opcontrol --reset; sudo opcontrol --start-daemon; sudo opcontrol --start; lli fib.bc; sudo opcontrol --stop opreport -g -d -l `which lli`|less */ #include <stdio.h> int fib_left(int); int fib_right(int); int fib_left(int i) { if (i < 2) return 1; return fib_left(i-1) + fib_right(i-2); } int fib_right(int i) { if (i < 2) return 1; return fib_left(i-1) + fib_right(i-2); } int fib(int i) { if (i < 2) return 1; return fib_left(i-1) + fib_right(i-2); } int main() { int i = 40; printf("fib(%d) == %d\n", i, fib(i)); } $ -------------- 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 `which 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 ...

Patch Set 1 #

Patch Set 2 : Refinements #

Patch Set 3 : Link libopagent.a instead of .so to avoid rpath. #

Patch Set 4 : Back to -l, but in LIBS instead of LDFLAGS so it appears in llvm-config #

Unified diffs Side-by-side diffs Delta from patch set Stats (+153 lines, -0 lines) Patch
M autoconf/configure.ac View 1 2 3 1 chunk +37 lines, -0 lines 0 comments Download
M include/llvm/Config/config.h.in View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M include/llvm/ExecutionEngine/JITEventListener.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M lib/ExecutionEngine/JIT/CMakeLists.txt View 2 1 chunk +1 line, -0 lines 0 comments Download
A lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp View 1 2 3 1 chunk +109 lines, -0 lines 0 comments Download
M tools/lli/lli.cpp View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b