Skip to content

Commit ea537f2

Browse files
committed
perf report/top: Do not offer annotation for symbols without samples
This can happen in the --children mode, i.e. the default mode when callchains are present, where one of the main entries may be a callchain entry with no samples. So far we were not providing any information about why an annotation couldn't be provided even offering the Annotation option in the popup menu. Work is needed to allow for no-samples "annotation', i.e. to show the disassembly anyway and allow for navigation, etc. Reviewed-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-0hhzj2de15o88cguy7h66zre@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4c8b9c0 commit ea537f2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/perf/ui/browsers/hists.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,8 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused,
24652465
struct popup_action *act, char **optstr,
24662466
struct map_symbol *ms)
24672467
{
2468-
if (ms->sym == NULL || ms->map->dso->annotate_warned)
2468+
if (ms->sym == NULL || ms->map->dso->annotate_warned ||
2469+
symbol__annotation(ms->sym)->src == NULL)
24692470
return 0;
24702471

24712472
if (asprintf(optstr, "Annotate %s", ms->sym->name) < 0)
@@ -3031,6 +3032,14 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
30313032
browser->selection->map->dso->annotate_warned)
30323033
continue;
30333034

3035+
if (symbol__annotation(browser->selection->sym)->src == NULL) {
3036+
ui_browser__warning(&browser->b, delay_secs * 2,
3037+
"No samples for the \"%s\" symbol.\n\n"
3038+
"Probably appeared just in a callchain",
3039+
browser->selection->sym->name);
3040+
continue;
3041+
}
3042+
30343043
actions->ms.map = browser->selection->map;
30353044
actions->ms.sym = browser->selection->sym;
30363045
do_annotate(browser, actions);

0 commit comments

Comments
 (0)