aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-11-16 01:06:28 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-23 08:44:07 -0500
commit69b7e48070ca2ecee7498166259b5826b22e8b2e (patch)
tree8c2915fe3fe520f872ecf61fbe5a20161f0dca87 /tools
parenta8763445f6c78628bd96d51649745065c0bb2c92 (diff)
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')
-rw-r--r--tools/perf/util/evsel.h1
-rw-r--r--tools/perf/util/evsel_fprintf.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8cd7cd227483..27fa3a343577 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -391,6 +391,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
391#define EVSEL__PRINT_ONELINE (1<<4) 391#define EVSEL__PRINT_ONELINE (1<<4)
392#define EVSEL__PRINT_SRCLINE (1<<5) 392#define EVSEL__PRINT_SRCLINE (1<<5)
393#define EVSEL__PRINT_UNKNOWN_AS_ADDR (1<<6) 393#define EVSEL__PRINT_UNKNOWN_AS_ADDR (1<<6)
394#define EVSEL__PRINT_CALLCHAIN_ARROW (1<<7)
394 395
395struct callchain_cursor; 396struct callchain_cursor;
396 397
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index ccb602397b60..53bb614feafb 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,
108 int print_oneline = print_opts & EVSEL__PRINT_ONELINE; 108 int print_oneline = print_opts & EVSEL__PRINT_ONELINE;
109 int print_srcline = print_opts & EVSEL__PRINT_SRCLINE; 109 int print_srcline = print_opts & EVSEL__PRINT_SRCLINE;
110 int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR; 110 int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR;
111 int print_arrow = print_opts & EVSEL__PRINT_CALLCHAIN_ARROW;
111 char s = print_oneline ? ' ' : '\t'; 112 char s = print_oneline ? ' ' : '\t';
113 bool first = true;
112 114
113 if (sample->callchain) { 115 if (sample->callchain) {
114 struct addr_location node_al; 116 struct addr_location node_al;
@@ -124,6 +126,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
124 126
125 printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); 127 printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
126 128
129 if (print_arrow && !first)
130 printed += fprintf(fp, " <-");
131
127 if (print_ip) 132 if (print_ip)
128 printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); 133 printed += fprintf(fp, "%c%16" PRIx64, s, node->ip);
129 134
@@ -158,6 +163,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
158 printed += fprintf(fp, "\n"); 163 printed += fprintf(fp, "\n");
159 164
160 callchain_cursor_advance(cursor); 165 callchain_cursor_advance(cursor);
166 first = false;
161 } 167 }
162 } 168 }
163 169