perf hists browser: Simplify symbol annotation menu setup

No need to repeat some tests, skip annotation instead.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6h6igrb81u4e6rwfmx7dv47n@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 107eb964
...@@ -1612,19 +1612,22 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -1612,19 +1612,22 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
if (!sort__has_sym) if (!sort__has_sym)
goto add_exit_option; goto add_exit_option;
if (browser->selection == NULL)
goto skip_annotation;
if (sort__mode == SORT_MODE__BRANCH) { if (sort__mode == SORT_MODE__BRANCH) {
bi = browser->he_selection->branch_info; bi = browser->he_selection->branch_info;
if (browser->selection != NULL &&
bi && if (bi == NULL)
bi->from.sym != NULL && goto skip_annotation;
if (bi->from.sym != NULL &&
!bi->from.map->dso->annotate_warned && !bi->from.map->dso->annotate_warned &&
asprintf(&options[nr_options], "Annotate %s", asprintf(&options[nr_options], "Annotate %s",
bi->from.sym->name) > 0) bi->from.sym->name) > 0)
annotate_f = nr_options++; annotate_f = nr_options++;
if (browser->selection != NULL && if (bi->to.sym != NULL &&
bi &&
bi->to.sym != NULL &&
!bi->to.map->dso->annotate_warned && !bi->to.map->dso->annotate_warned &&
(bi->to.sym != bi->from.sym || (bi->to.sym != bi->from.sym ||
bi->to.map->dso != bi->from.map->dso) && bi->to.map->dso != bi->from.map->dso) &&
...@@ -1632,8 +1635,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -1632,8 +1635,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
bi->to.sym->name) > 0) bi->to.sym->name) > 0)
annotate_t = nr_options++; annotate_t = nr_options++;
} else { } else {
if (browser->selection != NULL && if (browser->selection->sym != NULL &&
browser->selection->sym != NULL &&
!browser->selection->map->dso->annotate_warned) { !browser->selection->map->dso->annotate_warned) {
struct annotation *notes; struct annotation *notes;
...@@ -1645,7 +1647,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -1645,7 +1647,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
annotate = nr_options++; annotate = nr_options++;
} }
} }
skip_annotation:
if (thread != NULL && if (thread != NULL &&
asprintf(&options[nr_options], "Zoom %s %s(%d) thread", asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
(browser->hists->thread_filter ? "out of" : "into"), (browser->hists->thread_filter ? "out of" : "into"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment