perf script: Implement --graph-function
Add a ftrace style --graph-function argument to 'perf script' that
allows to print itrace function calls only below a given function. This
makes it easier to find the code of interest in a large trace.
% perf record -e intel_pt//k -a sleep 1
% perf script --graph-function group_sched_in --call-trace
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) group_sched_in
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) __x86_indirect_thunk_rax
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) event_sched_in.isra.107
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_event_set_state.part.71
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_event_update_time
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_pmu_disable
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_log_itrace_start
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) __x86_indirect_thunk_rax
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_event_update_userpage
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) calc_timer_values
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) sched_clock_cpu
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) __x86_indirect_thunk_rax
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) arch_perf_update_userpage
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) __fentry__
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) using_native_sched_clock
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) sched_clock_stable
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) perf_pmu_enable
perf 900 [000] 194167.
205652203: ([kernel.kallsyms]) __x86_indirect_thunk_rax
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) group_sched_in
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) __x86_indirect_thunk_rax
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) event_sched_in.isra.107
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) perf_event_set_state.part.71
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) perf_event_update_time
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) perf_pmu_disable
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) perf_log_itrace_start
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) __x86_indirect_thunk_rax
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) perf_event_update_userpage
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) calc_timer_values
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) sched_clock_cpu
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) __x86_indirect_thunk_rax
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) arch_perf_update_userpage
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) __fentry__
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) using_native_sched_clock
swapper 0 [001] 194167.
205660693: ([kernel.kallsyms]) sched_clock_stable
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Kim Phillips <kim.phillips@arm.com>
Link: http://lkml.kernel.org/r/20180920180540.14039-5-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>