Commit 18c9e5c567e1bc475edc67dca3680ecd2562dc5c

Authored by Namhyung Kim
Committed by Arnaldo Carvalho de Melo
1 parent c0e79be749

perf annotate: Make it to be able to skip unannotatable symbols

Add --skip-missing option for skipping symbols that cannot be used for
annotation.  It's the case of kernel symbols that user doesn't have a
vmlinux image file.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1360227734-375-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 2 changed files with 18 additions and 2 deletions Side-by-side Diff

tools/perf/Documentation/perf-annotate.txt
... ... @@ -90,6 +90,9 @@
90 90 --objdump=<path>::
91 91 Path to objdump binary.
92 92  
  93 +--skip-missing::
  94 + Skip symbols that cannot be annotated.
  95 +
93 96 SEE ALSO
94 97 --------
95 98 linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-annotate.c
... ... @@ -37,6 +37,7 @@
37 37 bool force, use_tui, use_stdio, use_gtk;
38 38 bool full_paths;
39 39 bool print_line;
  40 + bool skip_missing;
40 41 const char *sym_hist_filter;
41 42 const char *cpu_list;
42 43 DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
43 44  
... ... @@ -139,11 +140,21 @@
139 140 }
140 141  
141 142 if (use_browser == 2) {
142   - hist_entry__gtk_annotate(he, evidx, NULL);
143   - return;
  143 + int ret;
  144 +
  145 + ret = hist_entry__gtk_annotate(he, evidx, NULL);
  146 + if (!ret || !ann->skip_missing)
  147 + return;
  148 +
  149 + /* skip missing symbols */
  150 + nd = rb_next(nd);
144 151 } else if (use_browser == 1) {
145 152 key = hist_entry__tui_annotate(he, evidx, NULL);
146 153 switch (key) {
  154 + case -1:
  155 + if (!ann->skip_missing)
  156 + return;
  157 + /* fall through */
147 158 case K_RIGHT:
148 159 next = rb_next(nd);
149 160 break;
... ... @@ -288,6 +299,8 @@
288 299 "print matching source lines (may be slow)"),
289 300 OPT_BOOLEAN('P', "full-paths", &annotate.full_paths,
290 301 "Don't shorten the displayed pathnames"),
  302 + OPT_BOOLEAN(0, "skip-missing", &annotate.skip_missing,
  303 + "Skip symbols that cannot be annotated"),
291 304 OPT_STRING('C', "cpu", &annotate.cpu_list, "cpu", "list of cpus to profile"),
292 305 OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
293 306 "Look for files with symbols relative to this directory"),