alistair23-linux/tools/perf/arch
Sukadev Bhattiprolu a60335ba32 perf tools powerpc: Adjust callchain based on DWARF debug info
When saving the callchain on Power, the kernel conservatively saves excess
entries in the callchain. A few of these entries are needed in some cases
but not others. We should use the DWARF debug information to determine
when the entries are  needed.

Eg: the value in the link register (LR) is needed only when it holds the
return address of a function. At other times it must be ignored.

If the unnecessary entries are not ignored, we end up with duplicate arcs
in the call-graphs.

Use the DWARF debug information to determine if any callchain entries
should be ignored when building call-graphs.

Callgraph before the patch:

    14.67%          2234  sprintft  libc-2.18.so       [.] __random
            |
            --- __random
               |
               |--61.12%-- __random
               |          |
               |          |--97.15%-- rand
               |          |          do_my_sprintf
               |          |          main
               |          |          generic_start_main.isra.0
               |          |          __libc_start_main
               |          |          0x0
               |          |
               |           --2.85%-- do_my_sprintf
               |                     main
               |                     generic_start_main.isra.0
               |                     __libc_start_main
               |                     0x0
               |
                --38.88%-- rand
                          |
                          |--94.01%-- rand
                          |          do_my_sprintf
                          |          main
                          |          generic_start_main.isra.0
                          |          __libc_start_main
                          |          0x0
                          |
                           --5.99%-- do_my_sprintf
                                     main
                                     generic_start_main.isra.0
                                     __libc_start_main
                                     0x0

Callgraph after the patch:

    14.67%          2234  sprintft  libc-2.18.so       [.] __random
            |
            --- __random
               |
               |--95.93%-- rand
               |          do_my_sprintf
               |          main
               |          generic_start_main.isra.0
               |          __libc_start_main
               |          0x0
               |
                --4.07%-- do_my_sprintf
                          main
                          generic_start_main.isra.0
                          __libc_start_main
                          0x0

TODO:	For split-debug info objects like glibc, we can only determine
	the call-frame-address only when both .eh_frame and .debug_info
	sections are available. We should be able to determin the CFA
	even without the .eh_frame section.

Fix suggested by Anton Blanchard.

Thanks to valuable input on DWARF debug information from Ulrich Weigand.

Reported-by: Maynard Johnson <maynard@us.ibm.com>
Tested-by: Maynard Johnson <maynard@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20140625154903.GA29607@us.ibm.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
2014-06-27 11:14:51 +02:00
..
arm perf tools: Add libdw DWARF post unwind support for ARM 2014-05-16 11:39:29 +02:00
arm64 perf tools: Consolidate types.h for ARM and ARM64 2014-05-16 11:38:57 +02:00
powerpc perf tools powerpc: Adjust callchain based on DWARF debug info 2014-06-27 11:14:51 +02:00
s390 perf tools: Fix build on non-glibc systems due to libio.h absence 2013-03-15 13:05:13 -03:00
sh perf tools: Fix build on non-glibc systems due to libio.h absence 2013-03-15 13:05:13 -03:00
sparc perf tools: Fix build on non-glibc systems due to libio.h absence 2013-03-15 13:05:13 -03:00
x86 tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
common.c perf tools: Introduce zfree 2013-12-27 15:17:00 -03:00
common.h perf tools: Try to find cross-built objdump path 2012-10-24 14:20:11 -02:00