diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-03-18 10:50:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-03-18 17:17:03 -0400 |
commit | 9cdbadceca31bf2ccd9e50fecdc5591d3fb8dae3 (patch) | |
tree | 8c2da3c58767af88b78291745649867fa666e6bc /tools | |
parent | b9ce0c99d820b7680fdb4dc39bc7b5ff79d6b5b0 (diff) |
perf annotate: Print the evsel name in the stdio output
So that when showing multiple events annotations, we can figure out
which is which:
# perf record -a -e instructions,cycles sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.826 MB perf.data (~36078 samples) ]
# perf evlist
instructions
cycles
# perf annotate intel_idle 2> /dev/null | head -1
Percent | Source code & Disassembly of vmlinux for instructions
#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-n1r51l329434js84qtb2c6l9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/annotate.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 3aa555ff9d89..809b4c50beae 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1236,6 +1236,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1236 | struct dso *dso = map->dso; | 1236 | struct dso *dso = map->dso; |
1237 | char *filename; | 1237 | char *filename; |
1238 | const char *d_filename; | 1238 | const char *d_filename; |
1239 | const char *evsel_name = perf_evsel__name(evsel); | ||
1239 | struct annotation *notes = symbol__annotation(sym); | 1240 | struct annotation *notes = symbol__annotation(sym); |
1240 | struct disasm_line *pos, *queue = NULL; | 1241 | struct disasm_line *pos, *queue = NULL; |
1241 | u64 start = map__rip_2objdump(map, sym->start); | 1242 | u64 start = map__rip_2objdump(map, sym->start); |
@@ -1243,7 +1244,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1243 | int more = 0; | 1244 | int more = 0; |
1244 | u64 len; | 1245 | u64 len; |
1245 | int width = 8; | 1246 | int width = 8; |
1246 | int namelen; | 1247 | int namelen, evsel_name_len, graph_dotted_len; |
1247 | 1248 | ||
1248 | filename = strdup(dso->long_name); | 1249 | filename = strdup(dso->long_name); |
1249 | if (!filename) | 1250 | if (!filename) |
@@ -1256,14 +1257,17 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1256 | 1257 | ||
1257 | len = symbol__size(sym); | 1258 | len = symbol__size(sym); |
1258 | namelen = strlen(d_filename); | 1259 | namelen = strlen(d_filename); |
1260 | evsel_name_len = strlen(evsel_name); | ||
1259 | 1261 | ||
1260 | if (perf_evsel__is_group_event(evsel)) | 1262 | if (perf_evsel__is_group_event(evsel)) |
1261 | width *= evsel->nr_members; | 1263 | width *= evsel->nr_members; |
1262 | 1264 | ||
1263 | printf(" %-*.*s| Source code & Disassembly of %s\n", | 1265 | printf(" %-*.*s| Source code & Disassembly of %s for %s\n", |
1264 | width, width, "Percent", d_filename); | 1266 | width, width, "Percent", d_filename, evsel_name); |
1265 | printf("-%-*.*s-------------------------------------\n", | 1267 | |
1266 | width+namelen, width+namelen, graph_dotted_line); | 1268 | graph_dotted_len = width + namelen + evsel_name_len; |
1269 | printf("-%-*.*s-----------------------------------------\n", | ||
1270 | graph_dotted_len, graph_dotted_len, graph_dotted_line); | ||
1267 | 1271 | ||
1268 | if (verbose) | 1272 | if (verbose) |
1269 | symbol__annotate_hits(sym, evsel); | 1273 | symbol__annotate_hits(sym, evsel); |