[llvm-commits] Initial OProfile symbolization support

Chris Lattner clattner at apple.com
Tue Jun 30 21:36:56 PDT 2009


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 :)

-Chirs


>
>
>
> 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




More information about the llvm-commits mailing list