diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-06 09:36:35 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-07 16:00:52 -0400 |
commit | 724c9c9f20c7a0ebd9a728391f5adcfd4a76628b (patch) | |
tree | 672c67a2031ec07d4db264fa69a38d1a78b0cbb9 /tools/perf/util/ui | |
parent | 234a5375f6e7dee1f8bd5a7a2f5107c1c265ad8e (diff) |
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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui')
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index f0515cbabda5..b7901099eedb 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -26,6 +26,7 @@ struct hist_browser { | |||
26 | struct map_symbol *selection; | 26 | struct map_symbol *selection; |
27 | const struct thread *thread_filter; | 27 | const struct thread *thread_filter; |
28 | const struct dso *dso_filter; | 28 | const struct dso *dso_filter; |
29 | bool has_symbols; | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | static int hists__browser_title(struct hists *self, char *bf, size_t size, | 32 | 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 | int key; | 303 | int key; |
303 | int delay_msecs = delay_secs * 1000; | 304 | int delay_msecs = delay_secs * 1000; |
304 | char title[160]; | 305 | char title[160]; |
305 | int exit_keys[] = { 'a', '?', 'h', 'C', 'd', 'D', 'E', 't', | 306 | int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, }; |
306 | NEWT_KEY_ENTER, NEWT_KEY_RIGHT, NEWT_KEY_LEFT, | 307 | int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT, |
307 | NEWT_KEY_TAB, NEWT_KEY_UNTAB, 0, }; | 308 | NEWT_KEY_TAB, NEWT_KEY_UNTAB, NEWT_KEY_ENTER, 0, }; |
308 | 309 | ||
309 | self->b.entries = &self->hists->entries; | 310 | self->b.entries = &self->hists->entries; |
310 | self->b.nr_entries = self->hists->nr_entries; | 311 | 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 | newtFormSetTimer(self->b.form, delay_msecs); | 322 | newtFormSetTimer(self->b.form, delay_msecs); |
322 | 323 | ||
323 | ui_browser__add_exit_keys(&self->b, exit_keys); | 324 | ui_browser__add_exit_keys(&self->b, exit_keys); |
325 | if (self->has_symbols) | ||
326 | ui_browser__add_exit_keys(&self->b, sym_exit_keys); | ||
324 | 327 | ||
325 | while (1) { | 328 | while (1) { |
326 | key = ui_browser__run(&self->b); | 329 | key = ui_browser__run(&self->b); |
@@ -783,6 +786,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists) | |||
783 | self->hists = hists; | 786 | self->hists = hists; |
784 | self->b.refresh = hist_browser__refresh; | 787 | self->b.refresh = hist_browser__refresh; |
785 | self->b.seek = ui_browser__hists_seek; | 788 | self->b.seek = ui_browser__hists_seek; |
789 | self->has_symbols = sort_sym.list.next != NULL; | ||
786 | } | 790 | } |
787 | 791 | ||
788 | return self; | 792 | return self; |
@@ -881,16 +885,17 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
881 | case NEWT_KEY_F1: | 885 | case NEWT_KEY_F1: |
882 | case 'h': | 886 | case 'h': |
883 | case '?': | 887 | case '?': |
884 | ui__help_window("-> Zoom into DSO/Threads & Annotate current symbol\n" | 888 | ui__help_window("h/?/F1 Show this window\n" |
889 | "TAB/UNTAB Switch events\n" | ||
890 | "q/CTRL+C Exit browser\n\n" | ||
891 | "For symbolic views (--sort has sym):\n\n" | ||
892 | "-> Zoom into DSO/Threads & Annotate current symbol\n" | ||
885 | "<- Zoom out\n" | 893 | "<- Zoom out\n" |
886 | "a Annotate current symbol\n" | 894 | "a Annotate current symbol\n" |
887 | "h/?/F1 Show this window\n" | ||
888 | "C Collapse all callchains\n" | 895 | "C Collapse all callchains\n" |
889 | "E Expand all callchains\n" | 896 | "E Expand all callchains\n" |
890 | "d Zoom into current DSO\n" | 897 | "d Zoom into current DSO\n" |
891 | "t Zoom into current Thread\n" | 898 | "t Zoom into current Thread\n"); |
892 | "TAB/UNTAB Switch events\n" | ||
893 | "q/CTRL+C Exit browser"); | ||
894 | continue; | 899 | continue; |
895 | case NEWT_KEY_ENTER: | 900 | case NEWT_KEY_ENTER: |
896 | case NEWT_KEY_RIGHT: | 901 | case NEWT_KEY_RIGHT: |
@@ -923,6 +928,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
923 | goto out_free_stack; | 928 | goto out_free_stack; |
924 | } | 929 | } |
925 | 930 | ||
931 | if (!browser->has_symbols) | ||
932 | goto add_exit_option; | ||
933 | |||
926 | if (browser->selection != NULL && | 934 | if (browser->selection != NULL && |
927 | browser->selection->sym != NULL && | 935 | browser->selection->sym != NULL && |
928 | !browser->selection->map->dso->annotate_warned && | 936 | !browser->selection->map->dso->annotate_warned && |
@@ -947,7 +955,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
947 | browser->selection->map != NULL && | 955 | browser->selection->map != NULL && |
948 | asprintf(&options[nr_options], "Browse map details") > 0) | 956 | asprintf(&options[nr_options], "Browse map details") > 0) |
949 | browse_map = nr_options++; | 957 | browse_map = nr_options++; |
950 | 958 | add_exit_option: | |
951 | options[nr_options++] = (char *)"Exit"; | 959 | options[nr_options++] = (char *)"Exit"; |
952 | 960 | ||
953 | choice = ui__popup_menu(nr_options, options); | 961 | choice = ui__popup_menu(nr_options, options); |