perf annotate: Add number of samples to the header
authorPeter Zijlstra (Intel) <peterz@infradead.org>
Thu, 30 Jun 2016 08:29:55 +0000 (10:29 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 30 Jun 2016 21:27:42 +0000 (18:27 -0300)
Staring at annotations of large functions is useless if there's only a
few samples in them. Report the number of samples in the header to make
this easier to determine.

Committer note:

The change amounts to:

  - Percent | Source code & Disassembly of perf-vdso.so for cycles:u
  ------------------------------------------------------------------
  + Percent | Source code & Disassembly of perf-vdso.so for cycles:u (3278 samples)
  +--------------------------------------------------------------------------------

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20160630082955.GA30921@twins.programming.kicks-ass.net
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c

index 78e5d6f3ff613c700ae74ae393e5763aaa513fe7..e9825fe825fd65088ef807a3b54ca4a4a198ead7 100644 (file)
@@ -1522,6 +1522,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
        const char *d_filename;
        const char *evsel_name = perf_evsel__name(evsel);
        struct annotation *notes = symbol__annotation(sym);
+       struct sym_hist *h = annotation__histogram(notes, evsel->idx);
        struct disasm_line *pos, *queue = NULL;
        u64 start = map__rip_2objdump(map, sym->start);
        int printed = 2, queue_len = 0;
@@ -1544,8 +1545,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
        if (perf_evsel__is_group_event(evsel))
                width *= evsel->nr_members;
 
-       graph_dotted_len = printf(" %-*.*s|     Source code & Disassembly of %s for %s\n",
-              width, width, "Percent", d_filename, evsel_name);
+       graph_dotted_len = printf(" %-*.*s|     Source code & Disassembly of %s for %s (%" PRIu64 " samples)\n",
+              width, width, "Percent", d_filename, evsel_name, h->sum);
 
        printf("%-*.*s----\n",
               graph_dotted_len, graph_dotted_len, graph_dotted_line);