diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-13 07:31:22 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-13 07:53:18 -0400 |
commit | ed7e5662ddff6a60bdae830ff65547c2eeed6f9a (patch) | |
tree | 6a36c0963619426f2220330d0b9216cf00262110 /tools | |
parent | 3af6e33867b3814a73c3f3ba991a13d7304ad23a (diff) |
perf ui browser: Remove ui_browser__add_exit_keys
Users (hist_browser, etc) should just handle all keys, discarding the
ones they don't handle.
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-fjouann12v2k58t6vdd2wawb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/ui/browser.c | 18 | ||||
-rw-r--r-- | tools/perf/util/ui/browser.h | 2 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/annotate.c | 12 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 28 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/map.c | 3 |
5 files changed, 12 insertions, 51 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c index 05a0f61312d8..2923c493fb6a 100644 --- a/tools/perf/util/ui/browser.c +++ b/tools/perf/util/ui/browser.c | |||
@@ -142,20 +142,6 @@ void ui_browser__reset_index(struct ui_browser *self) | |||
142 | self->seek(self, 0, SEEK_SET); | 142 | self->seek(self, 0, SEEK_SET); |
143 | } | 143 | } |
144 | 144 | ||
145 | void ui_browser__add_exit_key(struct ui_browser *browser __used, int key __used) | ||
146 | { | ||
147 | } | ||
148 | |||
149 | void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]) | ||
150 | { | ||
151 | int i = 0; | ||
152 | |||
153 | while (keys[i] && i < 64) { | ||
154 | ui_browser__add_exit_key(self, keys[i]); | ||
155 | ++i; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | void __ui_browser__show_title(struct ui_browser *browser, const char *title) | 145 | void __ui_browser__show_title(struct ui_browser *browser, const char *title) |
160 | { | 146 | { |
161 | SLsmg_gotorc(0, 0); | 147 | SLsmg_gotorc(0, 0); |
@@ -175,16 +161,12 @@ int ui_browser__show(struct ui_browser *self, const char *title, | |||
175 | { | 161 | { |
176 | int err; | 162 | int err; |
177 | va_list ap; | 163 | va_list ap; |
178 | int keys[] = { NEWT_KEY_UP, NEWT_KEY_DOWN, NEWT_KEY_PGUP, | ||
179 | NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ', | ||
180 | NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 }; | ||
181 | 164 | ||
182 | ui_browser__refresh_dimensions(self); | 165 | ui_browser__refresh_dimensions(self); |
183 | 166 | ||
184 | pthread_mutex_lock(&ui__lock); | 167 | pthread_mutex_lock(&ui__lock); |
185 | __ui_browser__show_title(self, title); | 168 | __ui_browser__show_title(self, title); |
186 | 169 | ||
187 | ui_browser__add_exit_keys(self, keys); | ||
188 | self->title = title; | 170 | self->title = title; |
189 | free(self->helpline); | 171 | free(self->helpline); |
190 | self->helpline = NULL; | 172 | self->helpline = NULL; |
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h index 37d56bfe8fe3..7dd9d6107d12 100644 --- a/tools/perf/util/ui/browser.h +++ b/tools/perf/util/ui/browser.h | |||
@@ -32,8 +32,6 @@ void ui_browser__refresh_dimensions(struct ui_browser *self); | |||
32 | void ui_browser__reset_index(struct ui_browser *self); | 32 | void ui_browser__reset_index(struct ui_browser *self); |
33 | 33 | ||
34 | void ui_browser__gotorc(struct ui_browser *self, int y, int x); | 34 | void ui_browser__gotorc(struct ui_browser *self, int y, int x); |
35 | void ui_browser__add_exit_key(struct ui_browser *self, int key); | ||
36 | void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]); | ||
37 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); | 35 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); |
38 | void ui_browser__show_title(struct ui_browser *browser, const char *title); | 36 | void ui_browser__show_title(struct ui_browser *browser, const char *title); |
39 | int ui_browser__show(struct ui_browser *self, const char *title, | 37 | int ui_browser__show(struct ui_browser *self, const char *title, |
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c index 1967fbf73998..cbefb4fc99c4 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -175,12 +175,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
175 | struct rb_node *nd = NULL; | 175 | struct rb_node *nd = NULL; |
176 | struct map_symbol *ms = self->b.priv; | 176 | struct map_symbol *ms = self->b.priv; |
177 | struct symbol *sym = ms->sym; | 177 | struct symbol *sym = ms->sym; |
178 | /* | ||
179 | * RIGHT To allow builtin-annotate to cycle thru multiple symbols by | ||
180 | * examining the exit key for this function. | ||
181 | */ | ||
182 | int exit_keys[] = { 'H', NEWT_KEY_TAB, NEWT_KEY_UNTAB, | ||
183 | NEWT_KEY_RIGHT, NEWT_KEY_ENTER, 0 }; | ||
184 | int key; | 178 | int key; |
185 | 179 | ||
186 | if (ui_browser__show(&self->b, sym->name, | 180 | if (ui_browser__show(&self->b, sym->name, |
@@ -188,7 +182,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
188 | "cycle hottest lines, H: Hottest, -> Line action") < 0) | 182 | "cycle hottest lines, H: Hottest, -> Line action") < 0) |
189 | return -1; | 183 | return -1; |
190 | 184 | ||
191 | ui_browser__add_exit_keys(&self->b, exit_keys); | ||
192 | annotate_browser__calc_percent(self, evidx); | 185 | annotate_browser__calc_percent(self, evidx); |
193 | 186 | ||
194 | if (self->curr_hot) | 187 | if (self->curr_hot) |
@@ -292,8 +285,11 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
292 | timer, arg, delay_secs); | 285 | timer, arg, delay_secs); |
293 | } | 286 | } |
294 | break; | 287 | break; |
295 | default: | 288 | case 'q': |
289 | case CTRL('c'): | ||
296 | goto out; | 290 | goto out; |
291 | default: | ||
292 | continue; | ||
297 | } | 293 | } |
298 | 294 | ||
299 | if (nd != NULL) | 295 | if (nd != NULL) |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 603d6ee5a0d7..662b7217a031 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -302,9 +302,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, | |||
302 | { | 302 | { |
303 | int key; | 303 | int key; |
304 | char title[160]; | 304 | char title[160]; |
305 | int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, }; | ||
306 | int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT, | ||
307 | NEWT_KEY_TAB, NEWT_KEY_UNTAB, NEWT_KEY_ENTER, 0, }; | ||
308 | 305 | ||
309 | self->b.entries = &self->hists->entries; | 306 | self->b.entries = &self->hists->entries; |
310 | self->b.nr_entries = self->hists->nr_entries; | 307 | self->b.nr_entries = self->hists->nr_entries; |
@@ -317,10 +314,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, | |||
317 | "Press '?' for help on key bindings") < 0) | 314 | "Press '?' for help on key bindings") < 0) |
318 | return -1; | 315 | return -1; |
319 | 316 | ||
320 | ui_browser__add_exit_keys(&self->b, exit_keys); | ||
321 | if (self->has_symbols) | ||
322 | ui_browser__add_exit_keys(&self->b, sym_exit_keys); | ||
323 | |||
324 | while (1) { | 317 | while (1) { |
325 | key = ui_browser__run(&self->b, delay_secs); | 318 | key = ui_browser__run(&self->b, delay_secs); |
326 | 319 | ||
@@ -921,8 +914,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
921 | !ui__dialog_yesno("Do you really want to exit?")) | 914 | !ui__dialog_yesno("Do you really want to exit?")) |
922 | continue; | 915 | continue; |
923 | /* Fall thru */ | 916 | /* Fall thru */ |
924 | default: | 917 | case 'q': |
918 | case CTRL('c'): | ||
925 | goto out_free_stack; | 919 | goto out_free_stack; |
920 | default: | ||
921 | continue; | ||
926 | } | 922 | } |
927 | 923 | ||
928 | if (!browser->has_symbols) | 924 | if (!browser->has_symbols) |
@@ -1056,7 +1052,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, | |||
1056 | int nr_events, const char *help, | 1052 | int nr_events, const char *help, |
1057 | void(*timer)(void *arg), void *arg, int delay_secs) | 1053 | void(*timer)(void *arg), void *arg, int delay_secs) |
1058 | { | 1054 | { |
1059 | int exit_keys[] = { NEWT_KEY_ENTER, NEWT_KEY_RIGHT, 0, }; | ||
1060 | struct perf_evlist *evlist = menu->b.priv; | 1055 | struct perf_evlist *evlist = menu->b.priv; |
1061 | struct perf_evsel *pos; | 1056 | struct perf_evsel *pos; |
1062 | const char *ev_name, *title = "Available samples"; | 1057 | const char *ev_name, *title = "Available samples"; |
@@ -1066,8 +1061,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, | |||
1066 | "ESC: exit, ENTER|->: Browse histograms") < 0) | 1061 | "ESC: exit, ENTER|->: Browse histograms") < 0) |
1067 | return -1; | 1062 | return -1; |
1068 | 1063 | ||
1069 | ui_browser__add_exit_keys(&menu->b, exit_keys); | ||
1070 | |||
1071 | while (1) { | 1064 | while (1) { |
1072 | key = ui_browser__run(&menu->b, delay_secs); | 1065 | key = ui_browser__run(&menu->b, delay_secs); |
1073 | 1066 | ||
@@ -1091,15 +1084,6 @@ browse_hists: | |||
1091 | break; | 1084 | break; |
1092 | case NEWT_KEY_LEFT: | 1085 | case NEWT_KEY_LEFT: |
1093 | continue; | 1086 | continue; |
1094 | case NEWT_KEY_ESCAPE: | ||
1095 | if (!ui__dialog_yesno("Do you really want to exit?")) | ||
1096 | continue; | ||
1097 | /* Fall thru */ | ||
1098 | default: | ||
1099 | goto out; | ||
1100 | } | ||
1101 | |||
1102 | switch (key) { | ||
1103 | case NEWT_KEY_TAB: | 1087 | case NEWT_KEY_TAB: |
1104 | if (pos->node.next == &evlist->entries) | 1088 | if (pos->node.next == &evlist->entries) |
1105 | pos = list_entry(evlist->entries.next, struct perf_evsel, node); | 1089 | pos = list_entry(evlist->entries.next, struct perf_evsel, node); |
@@ -1114,6 +1098,10 @@ browse_hists: | |||
1114 | pos = list_entry(pos->node.prev, struct perf_evsel, node); | 1098 | pos = list_entry(pos->node.prev, struct perf_evsel, node); |
1115 | perf_evlist__set_selected(evlist, pos); | 1099 | perf_evlist__set_selected(evlist, pos); |
1116 | goto browse_hists; | 1100 | goto browse_hists; |
1101 | case NEWT_KEY_ESCAPE: | ||
1102 | if (!ui__dialog_yesno("Do you really want to exit?")) | ||
1103 | continue; | ||
1104 | /* Fall thru */ | ||
1117 | case 'q': | 1105 | case 'q': |
1118 | case CTRL('c'): | 1106 | case CTRL('c'): |
1119 | goto out; | 1107 | goto out; |
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c index 499db76bac2f..6905bcc8be2d 100644 --- a/tools/perf/util/ui/browsers/map.c +++ b/tools/perf/util/ui/browsers/map.c | |||
@@ -109,9 +109,6 @@ static int map_browser__run(struct map_browser *self) | |||
109 | verbose ? "" : "restart with -v to use") < 0) | 109 | verbose ? "" : "restart with -v to use") < 0) |
110 | return -1; | 110 | return -1; |
111 | 111 | ||
112 | if (verbose) | ||
113 | ui_browser__add_exit_key(&self->b, '/'); | ||
114 | |||
115 | while (1) { | 112 | while (1) { |
116 | key = ui_browser__run(&self->b, 0); | 113 | key = ui_browser__run(&self->b, 0); |
117 | 114 | ||