linux-stable/tools/perf
Milian Wolff 9856240ad3 perf callchain: Compare symbol name for inlined frames when matching
The fake symbols we create for inlined frames will represent different
functions but can use the symbol start address. This leads to issues
when different inline branches all lead to the same function.

Before:
~~~~~
$ perf report -s sym -i perf.inlining.data --inline --stdio -g function
...
             --38.86%--_start
                       __libc_start_main
                       main
                       |
                        --37.57%--std::norm<double> (inlined)
                                  std::_Norm_helper<true>::_S_do_it<double> (inlined)
                                  |
                                   --36.36%--std::abs<double> (inlined)
                                             std::__complex_abs (inlined)
                                             |
                                              --12.24%--std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>::operator() (inlined)
                                                        std::__detail::__mod<unsigned long, 2147483647ul, 16807ul, 0ul> (inlined)
                                                        std::__detail::_Mod<unsigned long, 2147483647ul, 16807ul, 0ul, true, true>::__calc (inlined)
~~~~~

Note that this backtrace representation is completely bogus.
Complex abs does not call the linear congruential engine! It
is just a side-effect of a longer inlined stack being appended
to a shorter, different inlined stack, both of which originate
in the same function (main).

This patch fixes the issue:

~~~~~
$ perf report -s sym -i perf.inlining.data --inline --stdio -g function
...
             --38.86%--_start
                       __libc_start_main
                       main
                       |
                       |--35.59%--std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                       |          std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                       |          |
                       |           --34.37%--std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator() (inlined)
                       |                     std::generate_canonical<double, 53ul, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                       |                     |
                       |                      --12.24%--std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>::operator() (inlined)
                       |                                std::__detail::__mod<unsigned long, 2147483647ul, 16807ul, 0ul> (inlined)
                       |                                std::__detail::_Mod<unsigned long, 2147483647ul, 16807ul, 0ul, true, true>::__calc (inlined)
                       |
                        --1.99%--std::norm<double> (inlined)
                                  std::_Norm_helper<true>::_S_do_it<double> (inlined)
                                  std::abs<double> (inlined)
                                  std::__complex_abs (inlined)
~~~~~

Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Yao Jin <yao.jin@linux.intel.com>
Link: http://lkml.kernel.org/r/20171009203310.17362-10-milian.wolff@kdab.com
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
[ Fix up conflict with c1fbc0cf81 ("perf callchain: Compare dsos (as well) for CCKEY_FUNCTION"), remove unneeded hunk ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-10-24 09:59:56 -03:00
..
arch perf annotate: Remove arch::cpuid_parse callback 2017-10-23 11:20:54 -03:00
bench perf tools: Use __maybe_unused consistently 2017-06-19 15:27:06 -03:00
Documentation perf list: Fix group description in the man page 2017-10-23 11:20:54 -03:00
jvmti perf jit: fix typo: "incalid" -> "invalid" 2017-06-27 11:55:06 -03:00
pmu-events perf vendor events: Add Goldmont Plus V1 event file 2017-10-23 16:30:54 -03:00
python
scripts perf script python: Add support for sqlite3 to call-graph-from-sql.py 2017-08-15 17:03:38 -03:00
tests perf tests attr: Make hw events optional 2017-10-23 11:20:54 -03:00
trace perf trace beauty madvise: Generate 'behavior' string table from kernel headers 2017-09-21 13:12:59 -03:00
ui perf report: Remove code to handle inline frames from browsers 2017-10-24 09:59:55 -03:00
util perf callchain: Compare symbol name for inlined frames when matching 2017-10-24 09:59:56 -03:00
.gitignore
Build perf trace: Only build tools/perf/trace/beauty/ when building 'perf trace' 2017-07-18 23:13:52 -03:00
builtin-annotate.c perf annotate browser: Support --show-nr-samples option 2017-08-18 11:15:09 -03:00
builtin-bench.c
builtin-buildid-cache.c perf buildid-cache: Cache debuginfo 2017-07-18 23:14:11 -03:00
builtin-buildid-list.c
builtin-c2c.c perf tools: Fix leaking rec_argv in error cases 2017-09-18 09:40:21 -03:00
builtin-config.c perf config: Write a config file just once 2017-09-13 09:49:15 -03:00
builtin-data.c perf data: Add doc when no conversion support compiled 2017-07-28 16:30:45 -03:00
builtin-diff.c perf config: Do not die when parsing u64 or int config values 2017-06-27 11:44:58 -03:00
builtin-evlist.c
builtin-ftrace.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
builtin-help.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
builtin-inject.c perf tools: Add feature header record to pipe-mode 2017-07-18 23:14:36 -03:00
builtin-kallsyms.c
builtin-kmem.c perf kmem: Perform some cleanup if '--time' is given an invalid value 2017-10-23 16:30:53 -03:00
builtin-kvm.c perf top: Implement multithreading for perf_event__synthesize_threads 2017-10-03 09:27:46 -03:00
builtin-list.c perf list: Add metric groups to perf list 2017-09-13 09:49:13 -03:00
builtin-lock.c
builtin-mem.c perf tools: Fix leaking rec_argv in error cases 2017-09-18 09:40:21 -03:00
builtin-probe.c perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
builtin-record.c perf mmap: Adopt push method from builtin-record.c 2017-10-23 11:20:54 -03:00
builtin-report.c perf report: Group stat values on global event id 2017-08-28 16:44:44 -03:00
builtin-sched.c perf sched timehist: Add pid and tid options 2017-09-13 09:49:12 -03:00
builtin-script.c perf script: Fix error handling path 2017-10-23 16:30:53 -03:00
builtin-stat.c perf stat: Fall weak group back even for EBADF 2017-09-13 09:49:16 -03:00
builtin-timechart.c perf tools: Fix leaking rec_argv in error cases 2017-09-18 09:40:21 -03:00
builtin-top.c perf top: Add option to set the number of thread for event synthesize 2017-10-03 09:27:54 -03:00
builtin-trace.c perf tools: Introduce binary__fprintf() 2017-10-23 16:30:52 -03:00
builtin-version.c perf tools: Remove string.h, unistd.h and sys/stat.h from util.h 2017-04-24 13:43:33 -03:00
builtin.h perf tools: Remove stale prototypes from builtin.h 2017-04-24 13:43:33 -03:00
check-headers.sh perf tools: Do not check ABI headers in a detached tarball build 2017-10-23 16:30:50 -03:00
command-list.txt
CREDITS
design.txt
Makefile
Makefile.config perf tools: Robustify detection of clang binary 2017-08-28 16:44:46 -03:00
Makefile.perf perf trace beauty madvise: Generate 'behavior' string table from kernel headers 2017-09-21 13:12:59 -03:00
MANIFEST perf tools: Get all of tools/{arch,include}/ in the MANIFEST 2017-09-25 10:39:43 -03:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h perf tools: Use default CPUINFO_PROC where it fits 2017-08-17 16:58:21 -03:00
perf-with-kcore.sh
perf.c perf tools: Support running perf binaries with a dash in their name 2017-09-12 12:48:54 -03:00
perf.h perf record: Support direct --user-regs arguments 2017-09-13 09:49:14 -03:00