linux-stable/tools/perf
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
..
arch perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
bench perf bench: Add epoll_ctl(2) benchmark 2018-11-21 22:39:55 -03:00
Documentation perf script: Allow +- operator for type specific fields option 2019-02-20 16:15:35 -03:00
examples/bpf perf augmented_syscalls: Convert to bpf_map() 2019-01-25 15:12:11 +01:00
include/bpf perf bpf: Convert pid_map() to bpf_map() 2019-01-25 15:12:10 +01:00
jvmti perf jvmti: Separate jvmti cmlr check 2018-11-21 22:39:58 -03:00
pmu-events perf vendor events power9: General metrics 2019-02-14 13:31:11 -03:00
python
scripts perf scripts python: exported-sql-viewer.py: Add call tree 2019-03-01 15:04:16 -03:00
tests perf test: Fix failure of 'evsel-tp-sched' test on s390 2019-02-19 13:43:29 -03:00
trace perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
ui perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
util perf db-export: Add calls parent_id to enable creation of call trees 2019-03-01 14:50:47 -03:00
.gitignore
Build perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
builtin-annotate.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-bench.c perf bench: Add epoll_ctl(2) benchmark 2018-11-21 22:39:55 -03:00
builtin-buildid-cache.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-buildid-list.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-c2c.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-config.c perf config: Show the configuration when no arguments are provided 2018-12-18 12:24:00 -03:00
builtin-data.c
builtin-diff.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-evlist.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-ftrace.c
builtin-help.c perf help: Remove needless use of strncpy() 2018-12-17 14:59:18 -03:00
builtin-inject.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-kallsyms.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
builtin-kmem.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-kvm.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-list.c perf list: Display metric expressions for --details option 2019-02-14 15:18:09 -03:00
builtin-lock.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-mem.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-probe.c perf namespaces: Remove namespaces.h from .h headers 2019-01-25 15:12:09 +01:00
builtin-record.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-report.c perf time-utils: Refactor time range parsing code 2019-03-01 11:03:53 -03:00
builtin-sched.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-script.c perf time-utils: Refactor time range parsing code 2019-03-01 11:03:53 -03:00
builtin-stat.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-timechart.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-top.c perf pmu: Remove set_drv_config API 2019-02-06 10:00:39 -03:00
builtin-trace.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-version.c perf version: Print status for syscall_table 2018-04-12 10:33:34 -03:00
builtin.h
check-headers.sh tools headers powerpc: Remove unistd.h 2019-01-10 10:42:08 -03:00
command-list.txt perf help: Add missing subcommand version 2018-09-19 14:53:36 -03:00
CREDITS
design.txt perf/doc: Update design.txt for exclude_{host|guest} flags 2019-01-21 11:01:18 +01:00
Makefile perf tools: Disable parallelism for 'make clean' 2018-08-20 08:54:58 -03:00
Makefile.config perf build: Add missing FEATURE_CHECK_LDFLAGS-libcrypto 2019-02-14 15:18:05 -03:00
Makefile.perf perf tools: Rename LIB_FILE to LIBPERF_A 2019-02-14 15:18:08 -03:00
MANIFEST
perf-archive.sh
perf-completion.sh
perf-read-vdso.c perf tools: Make find_vdso_map() more modular 2019-01-08 13:28:13 -03:00
perf-sys.h
perf-with-kcore.sh
perf.c perf tools: Remove dead quote.[ch] code 2018-06-04 10:28:50 -03:00
perf.h perf record: Allocate affinity masks 2019-02-06 10:00:39 -03:00