Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#231 Use libunwind for more accurate callgraph profiling

open
None
5
2013-10-16
2012-12-19
Maynard Johnson
No

This is a feature request to update operf to use additional information provided by the kernel via the PERF_SAMPLE_STACK_USER sample type. If this sample type is supported (kernel version 3.7?), then operf can pass the additional kernel data to libunwind to accurately ascertain the caller of a function.

Discussion

  • Use the val4.c testcase to reproduce problems with callgraph which are hinted at in http://oprofile.sourceforge.net/doc/interpreting-callgraph.html. The logic flow in val4.c is:
    main -> fn2 -> fn1

    Steps to reproduce:
    1. On Intel/RHEL 6.4, use stock gcc and compile thusly:
    gcc -O1 val4.c -o val4_O1_stock
    2. Then run 'operf -g ./val4_O1_stock'
    3. Then 'opreport -c' will show an incorrect callgraph:

    samples  %        image name               symbol name
    -------------------------------------------------------------------------------
    27157    49.9706  val4_O1_stock            fn2
      27157    99.8272  val4_O1_stock            fn2 [self]
      47        0.1728  no-vmlinux               /no-vmlinux
    -------------------------------------------------------------------------------
    27078    49.8252  val4_O1_stock            fn1
      27078    99.8194  val4_O1_stock            fn1 [self]
      49        0.1806  no-vmlinux               /no-vmlinux
    -------------------------------------------------------------------------------
    

    ^^^^^^^^^^^^^^^

    Compiling val4.c with either 'O0' or 'O1 -fno-omit-frame-pointer' seems to resolve or at least ameliorate the problem.

     
    Last edit: Maynard Johnson 2013-10-16
    Attachments