alistair23-linux/tools
Adrian Hunter ae8b887c00 perf scripts python: exported-sql-viewer.py: Add call tree
Add a new report to display a call tree. The Call Tree report is very
similar to the Context-Sensitive Call Graph, but the data is not
aggregated. Also the 'Count' column, which would be always 1, is replaced
by the 'Call Time'.

Committer testing:

  $ cat simple-retpoline.c
  /*

    https://lkml.kernel.org/r/20190109091835.5570-6-adrian.hunter@intel.com

  $ gcc -ggdb3 -Wall -Wextra -O2 -o simple-retpoline simple-retpoline.c
  $ objdump -d simple-retpoline
  */

  __attribute__((noinline)) int bar(void)
  {
          return -1;
  }

  int foo(void)
  {
          return bar() + 1;
  }

  __attribute__((indirect_branch("thunk"))) int main()
  {
          int (*volatile fn)(void) = foo;

          fn();
          return fn();
  }
  $
  $ perf record -o simple-retpoline.perf.data -e intel_pt/cyc/u ./simple-retpoline
  $ perf script -i simple-retpoline.perf.data --itrace=be -s ~acme/libexec/perf-core/scripts/python/export-to-sqlite.py simple-retpoline.db branches calls
  $ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py simple-retpoline.db

And in the GUI select:

    "Reports"
      "Call Tree"

    Call Path                 | Object          | Call Time (ns) | Time (ns) | Time (%) | Branch Count | Brach Count (%) |
    > simple-retpolin
      > PID:TID
        > _start                ld-2.28.so       2193855505777      156267      100.0       10602          100.0
            unknown             unknown          2193855506010        2276        1.5           1            0.0
          > _dl_start           ld-2.28.so       2193855508286      137047       87.7       10088           95.2
          > _dl_init            ld-2.28.so       2193855645444        9142        5.9         326            3.1
          > _start              simple-retpoline 2193855654587        7457        4.8         182            1.7
            > __libc_start_main <SNIP>
              <SNIP>
              > main            simple-retpoline 2193855657493          32        0.5          12            6.7
                > foo           simple-retpoline 2193855657493          14       43.8           5           41.7
              <SNIP>

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-enf0w96gqzfpv4fi16pw9ovc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-03-01 15:04:16 -03:00
..
accounting
arch powerpc fixes for 5.0 #3 2019-01-19 05:55:42 +12:00
bpf tools: bpftool: fix crash with un-owned prog arrays 2019-01-28 23:59:46 +01:00
build tools build feature sched_getcpu: Undef _GNU_SOURCE at the end 2019-02-14 15:39:21 -03:00
cgroup
crypto
firewire
firmware
gpio tools gpio: Allow overriding CFLAGS 2018-12-28 16:33:08 -03:00
hv
iio tools: iio: iio_generic_buffer: make num_loops signed 2019-01-12 18:17:56 +00:00
include Merge branch 'linus' into perf/core, to pick up fixes 2019-02-28 08:27:17 +01:00
kvm/kvm_stat
laptop
leds
lib tools lib traceevent: Fix buffer overflow in arg_eval 2019-02-28 16:06:47 -03:00
memory-model
nfsd
objtool
pci
pcmcia
perf perf scripts python: exported-sql-viewer.py: Add call tree 2019-03-01 15:04:16 -03:00
power perf/core improvements and fixes: 2019-01-03 14:05:16 +01:00
scripts
spi
testing selftests: fib_tests: sleep after changing carrier. again. 2019-02-23 18:34:20 -08:00
thermal/tmon tools thermal tmon: Use -O3 instead of -O1 if available 2019-01-04 12:54:49 -03:00
time
usb
virtio virtio: fix test build after uio.h change 2018-12-19 18:23:49 -05:00
vm tools/vm/page_owner: use page_owner_sort in the use example 2019-01-08 17:15:11 -08:00
wmi
Makefile