diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-18 13:37:41 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-19 09:33:51 -0500 |
commit | b66d8c0caa8f7925ae75fed243b0482a901f21e1 (patch) | |
tree | c16e7257c612d54a6ff7af9c29ef627884d984a1 /tools/perf/util/annotate.c | |
parent | bf19b82e7cf033319525a9eab12216b59c41c519 (diff) |
perf annotate: Auto allocate symbol per addr hist buckets
Instead of open coding it in multiple places in 'report' and 'top'.
Acked-by: Namhyung Kim <namhyung@kernel.org>
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-ay1ushp57qsva9aw59rha5ve@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0fcd81ea31ae..93614cd3948f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -464,17 +464,12 @@ void symbol__annotate_zero_histograms(struct symbol *sym) | |||
464 | pthread_mutex_unlock(¬es->lock); | 464 | pthread_mutex_unlock(¬es->lock); |
465 | } | 465 | } |
466 | 466 | ||
467 | int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | 467 | static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map, |
468 | int evidx, u64 addr) | 468 | struct annotation *notes, int evidx, u64 addr) |
469 | { | 469 | { |
470 | unsigned offset; | 470 | unsigned offset; |
471 | struct annotation *notes; | ||
472 | struct sym_hist *h; | 471 | struct sym_hist *h; |
473 | 472 | ||
474 | notes = symbol__annotation(sym); | ||
475 | if (notes->src == NULL) | ||
476 | return -ENOMEM; | ||
477 | |||
478 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); | 473 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); |
479 | 474 | ||
480 | if (addr < sym->start || addr > sym->end) | 475 | if (addr < sym->start || addr > sym->end) |
@@ -491,6 +486,23 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
491 | return 0; | 486 | return 0; |
492 | } | 487 | } |
493 | 488 | ||
489 | int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | ||
490 | int evidx, u64 addr) | ||
491 | { | ||
492 | struct annotation *notes; | ||
493 | |||
494 | if (sym == NULL || use_browser != 1 || !sort__has_sym) | ||
495 | return 0; | ||
496 | |||
497 | notes = symbol__annotation(sym); | ||
498 | if (notes->src == NULL) { | ||
499 | if (symbol__alloc_hist(sym) < 0) | ||
500 | return -ENOMEM; | ||
501 | } | ||
502 | |||
503 | return __symbol__inc_addr_samples(sym, map, notes, evidx, addr); | ||
504 | } | ||
505 | |||
494 | static void disasm_line__init_ins(struct disasm_line *dl) | 506 | static void disasm_line__init_ins(struct disasm_line *dl) |
495 | { | 507 | { |
496 | dl->ins = ins__find(dl->name); | 508 | dl->ins = ins__find(dl->name); |