aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-11-23 20:11:13 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-25 08:49:38 -0500
commit2d9bbf6eb3825739efa9e91c256ce7ead60d8367 (patch)
tree025e9cd32a8c78812251594f6308217138ebb884
parentdbdebdc53822c38cc29b11f438f9bc70d7e18be2 (diff)
perf callchain: Add option to skip ignore symbol when printing callchains
For tracepoint events, callchains always contain certain functions. Sometimes it'd be better to skip those functions as they have no value. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20161124011114.7102-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-sched.c3
-rw-r--r--tools/perf/util/evsel.h1
-rw-r--r--tools/perf/util/evsel_fprintf.c7
3 files changed, 9 insertions, 2 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 829468defa07..43fcc13e402d 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1876,7 +1876,8 @@ static void timehist_print_sample(struct perf_sched *sched,
1876 1876
1877 sample__fprintf_sym(sample, al, 0, 1877 sample__fprintf_sym(sample, al, 0,
1878 EVSEL__PRINT_SYM | EVSEL__PRINT_ONELINE | 1878 EVSEL__PRINT_SYM | EVSEL__PRINT_ONELINE |
1879 EVSEL__PRINT_CALLCHAIN_ARROW, 1879 EVSEL__PRINT_CALLCHAIN_ARROW |
1880 EVSEL__PRINT_SKIP_IGNORED,
1880 &callchain_cursor, stdout); 1881 &callchain_cursor, stdout);
1881 1882
1882out: 1883out:
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 27fa3a343577..6abb89cd27f9 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -392,6 +392,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
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#define EVSEL__PRINT_CALLCHAIN_ARROW (1<<7)
395#define EVSEL__PRINT_SKIP_IGNORED (1<<8)
395 396
396struct callchain_cursor; 397struct callchain_cursor;
397 398
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 53bb614feafb..5a6f52284452 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -109,6 +109,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
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 int print_arrow = print_opts & EVSEL__PRINT_CALLCHAIN_ARROW;
112 int print_skip_ignored = print_opts & EVSEL__PRINT_SKIP_IGNORED;
112 char s = print_oneline ? ' ' : '\t'; 113 char s = print_oneline ? ' ' : '\t';
113 bool first = true; 114 bool first = true;
114 115
@@ -124,6 +125,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
124 if (!node) 125 if (!node)
125 break; 126 break;
126 127
128 if (node->sym && node->sym->ignore && print_skip_ignored)
129 goto next;
130
127 printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); 131 printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
128 132
129 if (print_arrow && !first) 133 if (print_arrow && !first)
@@ -162,8 +166,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
162 if (!print_oneline) 166 if (!print_oneline)
163 printed += fprintf(fp, "\n"); 167 printed += fprintf(fp, "\n");
164 168
165 callchain_cursor_advance(cursor);
166 first = false; 169 first = false;
170next:
171 callchain_cursor_advance(cursor);
167 } 172 }
168 } 173 }
169 174