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>
This commit is contained in:
Arnaldo Carvalho de Melo
2013-12-18 15:37:41 -03:00
parent bf19b82e7c
commit b66d8c0caa
3 changed files with 39 additions and 57 deletions

View File

@@ -464,17 +464,12 @@ void symbol__annotate_zero_histograms(struct symbol *sym)
pthread_mutex_unlock(&notes->lock);
}
int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
int evidx, u64 addr)
static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
struct annotation *notes, int evidx, u64 addr)
{
unsigned offset;
struct annotation *notes;
struct sym_hist *h;
notes = symbol__annotation(sym);
if (notes->src == NULL)
return -ENOMEM;
pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
if (addr < sym->start || addr > sym->end)
@@ -491,6 +486,23 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
return 0;
}
int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
int evidx, u64 addr)
{
struct annotation *notes;
if (sym == NULL || use_browser != 1 || !sort__has_sym)
return 0;
notes = symbol__annotation(sym);
if (notes->src == NULL) {
if (symbol__alloc_hist(sym) < 0)
return -ENOMEM;
}
return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
}
static void disasm_line__init_ins(struct disasm_line *dl)
{
dl->ins = ins__find(dl->name);