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.
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:
gcc -O1 val4.c -o val4_O1_stock
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