summaryrefslogtreecommitdiff
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-03-02 17:59:36 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-03-05 15:58:45 +0300
commit696703af37a28892db89ff6a6d0cdfde6fb803ab (patch)
tree2085b7c0ac98337176cd65424c601a7dcf50fffc /tools/perf/ui/browsers/annotate.c
parentb09c2364a4dc2a67e640c2b839d936302815693f (diff)
downloadlinux-696703af37a28892db89ff6a6d0cdfde6fb803ab.tar.xz
perf annotate: Find 'call' instruction target symbol at parsing time
So that we do it just once, not everytime we press enter or -> on a 'call' instruction line. 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-uysyojl1e6nm94amzzzs08tf@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 6ff6839558b0..618edf96353c 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -568,35 +568,28 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
struct map_symbol *ms = browser->b.priv;
struct disasm_line *dl = disasm_line(browser->selection);
struct annotation *notes;
- struct addr_map_symbol target = {
- .map = ms->map,
- .addr = map__objdump_2mem(ms->map, dl->ops.target.addr),
- };
char title[SYM_TITLE_MAX_SIZE];
if (!ins__is_call(&dl->ins))
return false;
- if (map_groups__find_ams(&target) ||
- map__rip_2objdump(target.map, target.map->map_ip(target.map,
- target.addr)) !=
- dl->ops.target.addr) {
+ if (!dl->ops.target.sym) {
ui_helpline__puts("The called function was not found.");
return true;
}
- notes = symbol__annotation(target.sym);
+ notes = symbol__annotation(dl->ops.target.sym);
pthread_mutex_lock(&notes->lock);
- if (notes->src == NULL && symbol__alloc_hist(target.sym) < 0) {
+ if (notes->src == NULL && symbol__alloc_hist(dl->ops.target.sym) < 0) {
pthread_mutex_unlock(&notes->lock);
ui__warning("Not enough memory for annotating '%s' symbol!\n",
- target.sym->name);
+ dl->ops.target.sym->name);
return true;
}
pthread_mutex_unlock(&notes->lock);
- symbol__tui_annotate(target.sym, target.map, evsel, hbt);
+ symbol__tui_annotate(dl->ops.target.sym, ms->map, evsel, hbt);
sym_title(ms->sym, ms->map, title, sizeof(title));
ui_browser__show_title(&browser->b, title);
return true;