opreport from 'operf --callgraph' profile shows incorrect recursive calls
When you collect a callgraph profile with operf, the opreport output
incorrectly implies recursive calls. For example, a simple memcpy
testcase that has the following true callchain:
main -> do_my_memcpy -> memcpy (libc)
appears as follows with 'opreport --callgraph' (focusing here just
on the do_my_memcpy callers and callees):
NOTE: Lines above the non-indented line show the callers of do_my_memcpy;
lines below the non-indented line show the callees of do_my_memcpy.
So it appears that do_my_memcpy calls itself, which it does not do.
If I use 'perf record' to get a callgraph profile, the 'perf report'
looks like the following:
6.88% memcpyt memcpyt [.] do_my_memcpy
So here, too, it seems to me that do_my_memcpy calls do_my_memcpy.
When I reported this issue to perf/perf_events kernel developers,
I was basically told that this behavior was "by design".
This patch makes an effort to handle this issue by having operf drop
the first address in the callchain if and only if it is the same
address as the second address in the callchain.
Signed-off-by: Maynard Johnson <firstname.lastname@example.org>