Skip to content

Commit

Permalink
perf annotate: Print the evsel name in the stdio output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
acmel committed Mar 18, 2014
1 parent b9ce0c9 commit 9cdbadc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,14 +1236,15 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
struct dso *dso = map->dso;
char *filename;
const char *d_filename;
const char *evsel_name = perf_evsel__name(evsel);
struct annotation *notes = symbol__annotation(sym);
struct disasm_line *pos, *queue = NULL;
u64 start = map__rip_2objdump(map, sym->start);
int printed = 2, queue_len = 0;
int more = 0;
u64 len;
int width = 8;
int namelen;
int namelen, evsel_name_len, graph_dotted_len;

filename = strdup(dso->long_name);
if (!filename)
Expand All @@ -1256,14 +1257,17 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,

len = symbol__size(sym);
namelen = strlen(d_filename);
evsel_name_len = strlen(evsel_name);

if (perf_evsel__is_group_event(evsel))
width *= evsel->nr_members;

printf(" %-*.*s| Source code & Disassembly of %s\n",
width, width, "Percent", d_filename);
printf("-%-*.*s-------------------------------------\n",
width+namelen, width+namelen, graph_dotted_line);
printf(" %-*.*s| Source code & Disassembly of %s for %s\n",
width, width, "Percent", d_filename, evsel_name);

graph_dotted_len = width + namelen + evsel_name_len;
printf("-%-*.*s-----------------------------------------\n",
graph_dotted_len, graph_dotted_len, graph_dotted_line);

if (verbose)
symbol__annotate_hits(sym, evsel);
Expand Down

0 comments on commit 9cdbadc

Please sign in to comment.