diff options
author | Namhyung Kim <namhyung@kernel.org> | 2016-11-16 15:06:28 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-11-23 10:44:07 -0300 |
commit | 69b7e48070ca2ecee7498166259b5826b22e8b2e (patch) | |
tree | 8c2915fe3fe520f872ecf61fbe5a20161f0dca87 /tools/perf/util/evsel_fprintf.c | |
parent | a8763445f6c78628bd96d51649745065c0bb2c92 (diff) | |
download | op-kernel-dev-69b7e48070ca2ecee7498166259b5826b22e8b2e.zip op-kernel-dev-69b7e48070ca2ecee7498166259b5826b22e8b2e.tar.gz |
perf evsel: Support printing callchains with arrows
The EVSEL__PRINT_CALLCHAIN_ARROW options can be used to print callchains
with arrows for readability. It will be used 'sched timehist' command
like below:
__schedule <- schedule <- schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
__schedule <- schedule <- schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
__schedule <- schedule <- worker_thread <- kthread <- ret_from_fork
Suggested-and-Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20161116060634.28477-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel_fprintf.c')
-rw-r--r-- | tools/perf/util/evsel_fprintf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index ccb6023..53bb614 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c @@ -108,7 +108,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, int print_oneline = print_opts & EVSEL__PRINT_ONELINE; int print_srcline = print_opts & EVSEL__PRINT_SRCLINE; int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR; + int print_arrow = print_opts & EVSEL__PRINT_CALLCHAIN_ARROW; char s = print_oneline ? ' ' : '\t'; + bool first = true; if (sample->callchain) { struct addr_location node_al; @@ -124,6 +126,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); + if (print_arrow && !first) + printed += fprintf(fp, " <-"); + if (print_ip) printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); @@ -158,6 +163,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, printed += fprintf(fp, "\n"); callchain_cursor_advance(cursor); + first = false; } } |