mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
perf annotation: Add symbol__get_annotation
Add a new utility function to get an function annotation out of existing code. Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1432749114-904-4-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
18ffdfe8e9
commit
83be34a7a9
1 changed files with 14 additions and 7 deletions
|
@ -506,6 +506,17 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct annotation *symbol__get_annotation(struct symbol *sym)
|
||||||
|
{
|
||||||
|
struct annotation *notes = symbol__annotation(sym);
|
||||||
|
|
||||||
|
if (notes->src == NULL) {
|
||||||
|
if (symbol__alloc_hist(sym) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
||||||
int evidx, u64 addr)
|
int evidx, u64 addr)
|
||||||
{
|
{
|
||||||
|
@ -513,13 +524,9 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
notes = symbol__get_annotation(sym);
|
||||||
notes = symbol__annotation(sym);
|
if (notes == NULL)
|
||||||
if (notes->src == NULL) {
|
return -ENOMEM;
|
||||||
if (symbol__alloc_hist(sym) < 0)
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
|
return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue