Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+9 -5
+9 -5
tools/perf/util/annotate.c
··· 1236 1236 struct dso *dso = map->dso; 1237 1237 char *filename; 1238 1238 const char *d_filename; 1239 + const char *evsel_name = perf_evsel__name(evsel); 1239 1240 struct annotation *notes = symbol__annotation(sym); 1240 1241 struct disasm_line *pos, *queue = NULL; 1241 1242 u64 start = map__rip_2objdump(map, sym->start); ··· 1244 1243 int more = 0; 1245 1244 u64 len; 1246 1245 int width = 8; 1247 - int namelen; 1246 + int namelen, evsel_name_len, graph_dotted_len; 1248 1247 1249 1248 filename = strdup(dso->long_name); 1250 1249 if (!filename) ··· 1257 1256 1258 1257 len = symbol__size(sym); 1259 1258 namelen = strlen(d_filename); 1259 + evsel_name_len = strlen(evsel_name); 1260 1260 1261 1261 if (perf_evsel__is_group_event(evsel)) 1262 1262 width *= evsel->nr_members; 1263 1263 1264 - printf(" %-*.*s| Source code & Disassembly of %s\n", 1265 - width, width, "Percent", d_filename); 1266 - printf("-%-*.*s-------------------------------------\n", 1267 - width+namelen, width+namelen, graph_dotted_line); 1264 + printf(" %-*.*s| Source code & Disassembly of %s for %s\n", 1265 + width, width, "Percent", d_filename, evsel_name); 1266 + 1267 + graph_dotted_len = width + namelen + evsel_name_len; 1268 + printf("-%-*.*s-----------------------------------------\n", 1269 + graph_dotted_len, graph_dotted_len, graph_dotted_line); 1268 1270 1269 1271 if (verbose) 1270 1272 symbol__annotate_hits(sym, evsel);