perf hists browser: Don't offer symbol actions when symbols not on --sort

Removing all the entries that only apply to symbols from the menu.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-7bap0cy2fxtorlj5hgsp48m1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 234a5375
...@@ -26,6 +26,7 @@ struct hist_browser { ...@@ -26,6 +26,7 @@ struct hist_browser {
struct map_symbol *selection; struct map_symbol *selection;
const struct thread *thread_filter; const struct thread *thread_filter;
const struct dso *dso_filter; const struct dso *dso_filter;
bool has_symbols;
}; };
static int hists__browser_title(struct hists *self, char *bf, size_t size, static int hists__browser_title(struct hists *self, char *bf, size_t size,
...@@ -302,9 +303,9 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, ...@@ -302,9 +303,9 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name,
int key; int key;
int delay_msecs = delay_secs * 1000; int delay_msecs = delay_secs * 1000;
char title[160]; char title[160];
int exit_keys[] = { 'a', '?', 'h', 'C', 'd', 'D', 'E', 't', int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, };
NEWT_KEY_ENTER, NEWT_KEY_RIGHT, NEWT_KEY_LEFT, int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT,
NEWT_KEY_TAB, NEWT_KEY_UNTAB, 0, }; NEWT_KEY_TAB, NEWT_KEY_UNTAB, NEWT_KEY_ENTER, 0, };
self->b.entries = &self->hists->entries; self->b.entries = &self->hists->entries;
self->b.nr_entries = self->hists->nr_entries; self->b.nr_entries = self->hists->nr_entries;
...@@ -321,6 +322,8 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, ...@@ -321,6 +322,8 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name,
newtFormSetTimer(self->b.form, delay_msecs); newtFormSetTimer(self->b.form, delay_msecs);
ui_browser__add_exit_keys(&self->b, exit_keys); ui_browser__add_exit_keys(&self->b, exit_keys);
if (self->has_symbols)
ui_browser__add_exit_keys(&self->b, sym_exit_keys);
while (1) { while (1) {
key = ui_browser__run(&self->b); key = ui_browser__run(&self->b);
...@@ -783,6 +786,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists) ...@@ -783,6 +786,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
self->hists = hists; self->hists = hists;
self->b.refresh = hist_browser__refresh; self->b.refresh = hist_browser__refresh;
self->b.seek = ui_browser__hists_seek; self->b.seek = ui_browser__hists_seek;
self->has_symbols = sort_sym.list.next != NULL;
} }
return self; return self;
...@@ -881,16 +885,17 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -881,16 +885,17 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
case NEWT_KEY_F1: case NEWT_KEY_F1:
case 'h': case 'h':
case '?': case '?':
ui__help_window("-> Zoom into DSO/Threads & Annotate current symbol\n" ui__help_window("h/?/F1 Show this window\n"
"TAB/UNTAB Switch events\n"
"q/CTRL+C Exit browser\n\n"
"For symbolic views (--sort has sym):\n\n"
"-> Zoom into DSO/Threads & Annotate current symbol\n"
"<- Zoom out\n" "<- Zoom out\n"
"a Annotate current symbol\n" "a Annotate current symbol\n"
"h/?/F1 Show this window\n"
"C Collapse all callchains\n" "C Collapse all callchains\n"
"E Expand all callchains\n" "E Expand all callchains\n"
"d Zoom into current DSO\n" "d Zoom into current DSO\n"
"t Zoom into current Thread\n" "t Zoom into current Thread\n");
"TAB/UNTAB Switch events\n"
"q/CTRL+C Exit browser");
continue; continue;
case NEWT_KEY_ENTER: case NEWT_KEY_ENTER:
case NEWT_KEY_RIGHT: case NEWT_KEY_RIGHT:
...@@ -923,6 +928,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -923,6 +928,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto out_free_stack; goto out_free_stack;
} }
if (!browser->has_symbols)
goto add_exit_option;
if (browser->selection != NULL && if (browser->selection != NULL &&
browser->selection->sym != NULL && browser->selection->sym != NULL &&
!browser->selection->map->dso->annotate_warned && !browser->selection->map->dso->annotate_warned &&
...@@ -947,7 +955,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -947,7 +955,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
browser->selection->map != NULL && browser->selection->map != NULL &&
asprintf(&options[nr_options], "Browse map details") > 0) asprintf(&options[nr_options], "Browse map details") > 0)
browse_map = nr_options++; browse_map = nr_options++;
add_exit_option:
options[nr_options++] = (char *)"Exit"; options[nr_options++] = (char *)"Exit";
choice = ui__popup_menu(nr_options, options); choice = ui__popup_menu(nr_options, options);
......
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