[llvm-commits] Initial OProfile symbolization support
Jeffrey Yasskin
jyasskin at google.com
Fri Jul 3 15:57:46 PDT 2009
On Tue, Jun 30, 2009 at 9:36 PM, Chris Lattner<clattner at apple.com> wrote:
>
> On Jun 29, 2009, at 3:32 PM, Jeffrey Yasskin wrote:
>
>> 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 patch looks fine to me. I don't think you need to worry about adding a
> testcase, but figuring out #1/#2 above seem important :)
The attached patch fixes #2 by putting the required -L and -rpath
flags in $LIBS instead of $LDFLAGS. This lets $(g++
../src/tools/lli/lli.cpp `./Debug/bin/llvm-config --cxxflags
--ldflags --libs` -I`pwd`/include) succeed. Linking oprofile
statically seems to require more changes to llvm-config, so I've
stopped pursuing that.
Anton expressed a preference toward only printing the oprofile link
flags from llvm-config when libLLVMJIT is included in the output.
Since there's no existing support for that, I'd like to investigate it
in a future patch.
Does this sound good to commit once I've re-verified that it passes tests?
>
>>
>>
>>
>> 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
>> ...
>> <oprofile.patch><fib.c>_______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oprofile.patch
Type: text/x-diff
Size: 7642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090703/e7ac3639/attachment.patch>
More information about the llvm-commits
mailing list