[llvm-commits] Add line numbers to OProfile

Jeffrey Yasskin jyasskin at google.com
Wed Jul 15 12:40:27 PDT 2009


Here's the patch.

On Wed, Jul 15, 2009 at 12:38 PM, <jyasskin at gmail.com> wrote:
> Reviewers: ,
>
> Message:
> Please take a look. I'll attach the patch shortly. Bruno, especially,
> let me know how I can make this fit better with your long-term plans for
> full Dwarf output.
>
> Description:
> Add line numbers to OProfile. To do this, I added a beginDebugLoc() call
> to the MachineCodeEmitter interface and made copying the start line of a
> function not conditional on whether we're emitting Dwarf debug
> information. I still need to propagate the beginDebugLoc() calls to the
> non-X86 targets, but I'm waiting to do that until LLVMdev confirms that
> this is the right approach.
>
> In the long run, it'll probably be better to gather this information
> through the DwarfWriter, but the DwarfWriter currently depends on the
> AsmPrinter and TargetAsmInfo, and fixing that would be out of the way
> for this patch.
>
> Sample output:
>
> $ sudo opcontrol --reset; sudo opcontrol --start-daemon; sudo opcontrol
> --start; Debug/bin/lli  fib.bc; sudo opcontrol --stop
> [sudo] password for jyasskin:
> Signalling daemon... done
> Profiler running.
> fib(40) == 165580141
> Stopping profiling.
>
> $  opreport -g -d -l `pwd`/Debug/bin/lli|head -60
> Overflow stats not available
> 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
> vma      samples  %        linenr info                 image name
>        symbol name
> 00007f62689160b0 25420    60.7364  fib.c:24                    20676.jo
>                fib_left
>   00007f62689160b0 1741      6.8489  fib.c:24
>   00007f62689160b1 91        0.3580  fib.c:24
>   00007f62689160b9 1934      7.6082  fib.c:24
>   00007f62689160c6 2012      7.9150  fib.c:27
>   00007f62689160c8 1072      4.2172  fib.c:27
>   00007f62689160cd 1280      5.0354  fib.c:27
>   00007f62689160cf 287       1.1290  fib.c:27
>   00007f62689160d3 1242      4.8859  fib.c:27
>   00007f62689160d6 1093      4.2998  fib.c:27
>   00007f62689160db 963       3.7884  fib.c:27
>   00007f62689160dd 240       0.9441  fib.c:27
>   00007f62689160e1 2781     10.9402  fib.c:28
>   00007f62689160e5 3704     14.5712  fib.c:28
>   00007f62689160ea 1         0.0039  fib.c:28
>   00007f62689160eb 596       2.3446  (no location information)
>   00007f62689160f3 6383     25.1101  (no location information)
> 00007f6268916100 15900    37.9901  fib.c:29                    20676.jo
>                fib_right
>   00007f6268916100 1669     10.4969  fib.c:29
>   00007f6268916101 68        0.4277  fib.c:29
>   00007f6268916109 2416     15.1950  fib.c:29
>   00007f6268916116 2262     14.2264  fib.c:32
>   00007f6268916118 605       3.8050  fib.c:32
>   00007f626891611d 700       4.4025  fib.c:32
>   00007f626891611f 384       2.4151  fib.c:32
>   00007f6268916123 434       2.7296  fib.c:32
>   00007f6268916126 647       4.0692  fib.c:32
>   00007f626891612b 921       5.7925  fib.c:32
>   00007f626891612d 73        0.4591  fib.c:32
>   00007f6268916131 1824     11.4717  fib.c:33
>   00007f6268916135 2873     18.0692  fib.c:33
>   00007f626891613a 2         0.0126  fib.c:33
>   00007f626891613b 1008      6.3396  (no location information)
>   00007f6268916143 14        0.0881  (no location information)
> 0000000000000000 16        0.0382  (no location information)
> libstdc++.so.6.0.9       /usr/lib/libstdc++.so.6.0.9
>   0000000000052fa0 1         6.2500  (no location information)
>   00000000000530f0 1         6.2500  (no location information)
>   0000000000062c4c 1         6.2500  (no location information)
>   000000000006bf02 1         6.2500  (no location information)
>   000000000006c4d6 1         6.2500  (no location information)
>   00000000000a13dd 1         6.2500  (no location information)
>   00000000000a19a0 1         6.2500  (no location information)
>   00000000000a244d 1         6.2500  (no location information)
>   00000000000a2b74 1         6.2500  (no location information)
>   00000000000a2b82 1         6.2500  (no location information)
>   00000000000a2b91 1         6.2500  (no location information)
>   00000000000a2bb9 2        12.5000  (no location information)
>   00000000000a7f45 1         6.2500  (no location information)
>   00000000000c2f10 1         6.2500  (no location information)
>   00000000000c4b30 1         6.2500  (no location information)
> 0000000000815e2a 13        0.0311  stl_vector.h:396            lli
>                std::vector<llvm::MachineOperand,
> std::allocator<llvm::MachineOperand> >::size() const
>   0000000000815e2a 2        15.3846  stl_vector.h:396
>   0000000000815e36 1         7.6923  stl_vector.h:397
>
>
> OProfile 0.9.4 has a bug that causes it to ignore line numbers for code
> addresses above 4G. A fix is at
> http://thread.gmane.org/gmane.linux.oprofile/7634 but may or may not
> make it into OProfile 0.9.5.
>
> Please review this at http://codereview.appspot.com/91111
>
> Affected files:
>   M     include/llvm/CodeGen/MachineCodeEmitter.h
>   M     include/llvm/ExecutionEngine/JITEventListener.h
>   M     include/llvm/Support/DebugLoc.h
>   M     lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
>   M     lib/ExecutionEngine/JIT/JITEmitter.cpp
>   M     lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
>   M     lib/Target/X86/X86CodeEmitter.cpp
>
>
> _______________________________________________
> 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_line_numbers.patch
Type: text/x-diff
Size: 11160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090715/fe7ce326/attachment.patch>


More information about the llvm-commits mailing list