perf annotate: Introduce symbol__hists()
In this case we're wanting just notes->src->histograms, allocating it if needed. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-4iatualjskia7sojmdb65cmm@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
e1a91a834d
commit
e8ea922a7e
|
@ -863,18 +863,38 @@ static struct annotation *symbol__get_annotation(struct symbol *sym, bool cycles
|
||||||
return notes;
|
return notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct annotated_source *symbol__hists(struct symbol *sym)
|
||||||
|
{
|
||||||
|
struct annotation *notes = symbol__annotation(sym);
|
||||||
|
|
||||||
|
if (notes->src == NULL) {
|
||||||
|
notes->src = annotated_source__new();
|
||||||
|
if (notes->src == NULL)
|
||||||
|
return NULL;
|
||||||
|
goto alloc_histograms;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notes->src->histograms == NULL) {
|
||||||
|
alloc_histograms:
|
||||||
|
annotated_source__alloc_histograms(notes->src, symbol__size(sym),
|
||||||
|
symbol_conf.nr_events);
|
||||||
|
}
|
||||||
|
|
||||||
|
return notes->src;
|
||||||
|
}
|
||||||
|
|
||||||
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
||||||
struct perf_evsel *evsel, u64 addr,
|
struct perf_evsel *evsel, u64 addr,
|
||||||
struct perf_sample *sample)
|
struct perf_sample *sample)
|
||||||
{
|
{
|
||||||
struct annotation *notes;
|
struct annotated_source *src;
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
notes = symbol__get_annotation(sym, false);
|
src = symbol__hists(sym);
|
||||||
if (notes == NULL)
|
if (src == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
return __symbol__inc_addr_samples(sym, map, notes->src, evsel->idx, addr, sample);
|
return __symbol__inc_addr_samples(sym, map, src, evsel->idx, addr, sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int symbol__account_cycles(u64 addr, u64 start,
|
static int symbol__account_cycles(u64 addr, u64 start,
|
||||||
|
|
Loading…
Reference in New Issue