diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-13 07:52:46 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-13 07:52:46 -0400 |
commit | 3af6e33867b3814a73c3f3ba991a13d7304ad23a (patch) | |
tree | 28f0f4071736faca07252439a0037e27f0895a53 | |
parent | 33e27312aeb05798572ccc456a76321125e8d7cb (diff) |
perf ui browser: Handle SIGWINCH
To do that we needed to stop using newtForm, as we don't want libnewt to
catch the xterm resize signal.
Remove some more newt calls and instead use the underlying libslang
directly. In time tools/perf will use just libslang.
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-h1824yjiru5n2ivz4bseizwj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-top.c | 21 | ||||
-rw-r--r-- | tools/perf/perf.c | 24 | ||||
-rw-r--r-- | tools/perf/perf.h | 2 | ||||
-rw-r--r-- | tools/perf/util/ui/browser.c | 137 | ||||
-rw-r--r-- | tools/perf/util/ui/browser.h | 6 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/annotate.c | 5 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 12 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/map.c | 3 | ||||
-rw-r--r-- | tools/perf/util/ui/helpline.h | 2 |
9 files changed, 144 insertions, 68 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c5aebf6eb746..de3cb1e00f9e 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -585,16 +585,31 @@ static void *display_thread(void *arg __used) | |||
585 | tc.c_cc[VMIN] = 0; | 585 | tc.c_cc[VMIN] = 0; |
586 | tc.c_cc[VTIME] = 0; | 586 | tc.c_cc[VTIME] = 0; |
587 | 587 | ||
588 | pthread__unblock_sigwinch(); | ||
588 | repeat: | 589 | repeat: |
589 | delay_msecs = top.delay_secs * 1000; | 590 | delay_msecs = top.delay_secs * 1000; |
590 | tcsetattr(0, TCSANOW, &tc); | 591 | tcsetattr(0, TCSANOW, &tc); |
591 | /* trash return*/ | 592 | /* trash return*/ |
592 | getc(stdin); | 593 | getc(stdin); |
593 | 594 | ||
594 | do { | 595 | while (1) { |
595 | print_sym_table(); | 596 | print_sym_table(); |
596 | } while (!poll(&stdin_poll, 1, delay_msecs) == 1); | 597 | /* |
597 | 598 | * Either timeout expired or we got an EINTR due to SIGWINCH, | |
599 | * refresh screen in both cases. | ||
600 | */ | ||
601 | switch (poll(&stdin_poll, 1, delay_msecs)) { | ||
602 | case 0: | ||
603 | continue; | ||
604 | case -1: | ||
605 | if (errno == EINTR) | ||
606 | continue; | ||
607 | /* Fall trhu */ | ||
608 | default: | ||
609 | goto process_hotkey; | ||
610 | } | ||
611 | } | ||
612 | process_hotkey: | ||
598 | c = getc(stdin); | 613 | c = getc(stdin); |
599 | tcsetattr(0, TCSAFLUSH, &save); | 614 | tcsetattr(0, TCSAFLUSH, &save); |
600 | 615 | ||
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index ec635b7cc8ea..73d0cac8b67e 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -427,6 +427,24 @@ static void get_debugfs_mntpt(void) | |||
427 | debugfs_mntpt[0] = '\0'; | 427 | debugfs_mntpt[0] = '\0'; |
428 | } | 428 | } |
429 | 429 | ||
430 | static void pthread__block_sigwinch(void) | ||
431 | { | ||
432 | sigset_t set; | ||
433 | |||
434 | sigemptyset(&set); | ||
435 | sigaddset(&set, SIGWINCH); | ||
436 | pthread_sigmask(SIG_BLOCK, &set, NULL); | ||
437 | } | ||
438 | |||
439 | void pthread__unblock_sigwinch(void) | ||
440 | { | ||
441 | sigset_t set; | ||
442 | |||
443 | sigemptyset(&set); | ||
444 | sigaddset(&set, SIGWINCH); | ||
445 | pthread_sigmask(SIG_UNBLOCK, &set, NULL); | ||
446 | } | ||
447 | |||
430 | int main(int argc, const char **argv) | 448 | int main(int argc, const char **argv) |
431 | { | 449 | { |
432 | const char *cmd; | 450 | const char *cmd; |
@@ -480,6 +498,12 @@ int main(int argc, const char **argv) | |||
480 | * time. | 498 | * time. |
481 | */ | 499 | */ |
482 | setup_path(); | 500 | setup_path(); |
501 | /* | ||
502 | * Block SIGWINCH notifications so that the thread that wants it can | ||
503 | * unblock and get syscalls like select interrupted instead of waiting | ||
504 | * forever while the signal goes to some other non interested thread. | ||
505 | */ | ||
506 | pthread__block_sigwinch(); | ||
483 | 507 | ||
484 | while (1) { | 508 | while (1) { |
485 | static int done_help; | 509 | static int done_help; |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 08b0b5e82a44..914c895510f7 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -183,4 +183,6 @@ struct ip_callchain { | |||
183 | extern bool perf_host, perf_guest; | 183 | extern bool perf_host, perf_guest; |
184 | extern const char perf_version_string[]; | 184 | extern const char perf_version_string[]; |
185 | 185 | ||
186 | void pthread__unblock_sigwinch(void); | ||
187 | |||
186 | #endif | 188 | #endif |
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c index 5911bba63858..05a0f61312d8 100644 --- a/tools/perf/util/ui/browser.c +++ b/tools/perf/util/ui/browser.c | |||
@@ -1,4 +1,7 @@ | |||
1 | #include "../util.h" | ||
2 | #include "../../perf.h" | ||
1 | #include "libslang.h" | 3 | #include "libslang.h" |
4 | #include <newt.h> | ||
2 | #include "ui.h" | 5 | #include "ui.h" |
3 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
4 | #include <linux/list.h> | 7 | #include <linux/list.h> |
@@ -8,8 +11,8 @@ | |||
8 | #include "browser.h" | 11 | #include "browser.h" |
9 | #include "helpline.h" | 12 | #include "helpline.h" |
10 | #include "../color.h" | 13 | #include "../color.h" |
11 | #include "../util.h" | 14 | |
12 | #include <stdio.h> | 15 | int newtGetKey(void); |
13 | 16 | ||
14 | static int ui_browser__percent_color(double percent, bool current) | 17 | static int ui_browser__percent_color(double percent, bool current) |
15 | { | 18 | { |
@@ -127,11 +130,8 @@ bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row) | |||
127 | 130 | ||
128 | void ui_browser__refresh_dimensions(struct ui_browser *self) | 131 | void ui_browser__refresh_dimensions(struct ui_browser *self) |
129 | { | 132 | { |
130 | int cols, rows; | 133 | self->width = SLtt_Screen_Cols - 1; |
131 | newtGetScreenSize(&cols, &rows); | 134 | self->height = SLtt_Screen_Rows - 2; |
132 | |||
133 | self->width = cols - 1; | ||
134 | self->height = rows - 2; | ||
135 | self->y = 1; | 135 | self->y = 1; |
136 | self->x = 0; | 136 | self->x = 0; |
137 | } | 137 | } |
@@ -142,9 +142,8 @@ 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 *self, int key) | 145 | void ui_browser__add_exit_key(struct ui_browser *browser __used, int key __used) |
146 | { | 146 | { |
147 | newtFormAddHotKey(self->form, key); | ||
148 | } | 147 | } |
149 | 148 | ||
150 | void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]) | 149 | void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]) |
@@ -161,7 +160,7 @@ void __ui_browser__show_title(struct ui_browser *browser, const char *title) | |||
161 | { | 160 | { |
162 | SLsmg_gotorc(0, 0); | 161 | SLsmg_gotorc(0, 0); |
163 | ui_browser__set_color(browser, NEWT_COLORSET_ROOT); | 162 | ui_browser__set_color(browser, NEWT_COLORSET_ROOT); |
164 | slsmg_write_nstring(title, browser->width); | 163 | slsmg_write_nstring(title, browser->width + 1); |
165 | } | 164 | } |
166 | 165 | ||
167 | void ui_browser__show_title(struct ui_browser *browser, const char *title) | 166 | void ui_browser__show_title(struct ui_browser *browser, const char *title) |
@@ -174,57 +173,75 @@ void ui_browser__show_title(struct ui_browser *browser, const char *title) | |||
174 | int ui_browser__show(struct ui_browser *self, const char *title, | 173 | int ui_browser__show(struct ui_browser *self, const char *title, |
175 | const char *helpline, ...) | 174 | const char *helpline, ...) |
176 | { | 175 | { |
176 | int err; | ||
177 | va_list ap; | 177 | va_list ap; |
178 | int keys[] = { NEWT_KEY_UP, NEWT_KEY_DOWN, NEWT_KEY_PGUP, | 178 | int keys[] = { NEWT_KEY_UP, NEWT_KEY_DOWN, NEWT_KEY_PGUP, |
179 | NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ', | 179 | NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ', |
180 | NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 }; | 180 | NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 }; |
181 | 181 | ||
182 | if (self->form != NULL) | ||
183 | newtFormDestroy(self->form); | ||
184 | |||
185 | ui_browser__refresh_dimensions(self); | 182 | ui_browser__refresh_dimensions(self); |
186 | self->form = newtForm(NULL, NULL, 0); | ||
187 | if (self->form == NULL) | ||
188 | return -1; | ||
189 | |||
190 | self->sb = newtVerticalScrollbar(self->width, 1, self->height, | ||
191 | HE_COLORSET_NORMAL, | ||
192 | HE_COLORSET_SELECTED); | ||
193 | if (self->sb == NULL) | ||
194 | return -1; | ||
195 | 183 | ||
196 | pthread_mutex_lock(&ui__lock); | 184 | pthread_mutex_lock(&ui__lock); |
197 | __ui_browser__show_title(self, title); | 185 | __ui_browser__show_title(self, title); |
198 | 186 | ||
199 | ui_browser__add_exit_keys(self, keys); | 187 | ui_browser__add_exit_keys(self, keys); |
200 | newtFormAddComponent(self->form, self->sb); | 188 | self->title = title; |
189 | free(self->helpline); | ||
190 | self->helpline = NULL; | ||
201 | 191 | ||
202 | va_start(ap, helpline); | 192 | va_start(ap, helpline); |
203 | ui_helpline__vpush(helpline, ap); | 193 | err = vasprintf(&self->helpline, helpline, ap); |
204 | va_end(ap); | 194 | va_end(ap); |
195 | if (err > 0) | ||
196 | ui_helpline__push(self->helpline); | ||
205 | pthread_mutex_unlock(&ui__lock); | 197 | pthread_mutex_unlock(&ui__lock); |
206 | return 0; | 198 | return err ? 0 : -1; |
207 | } | 199 | } |
208 | 200 | ||
209 | void ui_browser__hide(struct ui_browser *self) | 201 | void ui_browser__hide(struct ui_browser *browser __used) |
210 | { | 202 | { |
211 | pthread_mutex_lock(&ui__lock); | 203 | pthread_mutex_lock(&ui__lock); |
212 | newtFormDestroy(self->form); | ||
213 | self->form = NULL; | ||
214 | ui_helpline__pop(); | 204 | ui_helpline__pop(); |
215 | pthread_mutex_unlock(&ui__lock); | 205 | pthread_mutex_unlock(&ui__lock); |
216 | } | 206 | } |
217 | 207 | ||
218 | int ui_browser__refresh(struct ui_browser *self) | 208 | static void ui_browser__scrollbar_set(struct ui_browser *browser) |
209 | { | ||
210 | int height = browser->height, h = 0, pct = 0, | ||
211 | col = browser->width, | ||
212 | row = browser->y - 1; | ||
213 | |||
214 | if (browser->nr_entries > 1) { | ||
215 | pct = ((browser->index * (browser->height - 1)) / | ||
216 | (browser->nr_entries - 1)); | ||
217 | } | ||
218 | |||
219 | while (h < height) { | ||
220 | ui_browser__gotorc(browser, row++, col); | ||
221 | SLsmg_set_char_set(1); | ||
222 | SLsmg_write_char(h == pct ? SLSMG_DIAMOND_CHAR : SLSMG_BOARD_CHAR); | ||
223 | SLsmg_set_char_set(0); | ||
224 | ++h; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | static int __ui_browser__refresh(struct ui_browser *browser) | ||
219 | { | 229 | { |
220 | int row; | 230 | int row; |
221 | 231 | ||
232 | row = browser->refresh(browser); | ||
233 | ui_browser__set_color(browser, HE_COLORSET_NORMAL); | ||
234 | SLsmg_fill_region(browser->y + row, browser->x, | ||
235 | browser->height - row, browser->width, ' '); | ||
236 | ui_browser__scrollbar_set(browser); | ||
237 | |||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | int ui_browser__refresh(struct ui_browser *browser) | ||
242 | { | ||
222 | pthread_mutex_lock(&ui__lock); | 243 | pthread_mutex_lock(&ui__lock); |
223 | newtScrollbarSet(self->sb, self->index, self->nr_entries - 1); | 244 | __ui_browser__refresh(browser); |
224 | row = self->refresh(self); | ||
225 | ui_browser__set_color(self, HE_COLORSET_NORMAL); | ||
226 | SLsmg_fill_region(self->y + row, self->x, | ||
227 | self->height - row, self->width, ' '); | ||
228 | pthread_mutex_unlock(&ui__lock); | 245 | pthread_mutex_unlock(&ui__lock); |
229 | 246 | ||
230 | return 0; | 247 | return 0; |
@@ -253,21 +270,49 @@ void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries) | |||
253 | browser->seek(browser, browser->top_idx, SEEK_SET); | 270 | browser->seek(browser, browser->top_idx, SEEK_SET); |
254 | } | 271 | } |
255 | 272 | ||
256 | int ui_browser__run(struct ui_browser *self) | 273 | int ui_browser__run(struct ui_browser *self, int delay_secs) |
257 | { | 274 | { |
258 | struct newtExitStruct es; | 275 | int err, key; |
276 | struct timeval timeout, *ptimeout = delay_secs ? &timeout : NULL; | ||
259 | 277 | ||
260 | if (ui_browser__refresh(self) < 0) | 278 | pthread__unblock_sigwinch(); |
261 | return -1; | ||
262 | 279 | ||
263 | while (1) { | 280 | while (1) { |
264 | off_t offset; | 281 | off_t offset; |
282 | fd_set read_set; | ||
265 | 283 | ||
266 | newtFormRun(self->form, &es); | 284 | pthread_mutex_lock(&ui__lock); |
285 | err = __ui_browser__refresh(self); | ||
286 | SLsmg_refresh(); | ||
287 | pthread_mutex_unlock(&ui__lock); | ||
288 | if (err < 0) | ||
289 | break; | ||
290 | |||
291 | FD_ZERO(&read_set); | ||
292 | FD_SET(0, &read_set); | ||
293 | |||
294 | if (delay_secs) { | ||
295 | timeout.tv_sec = delay_secs; | ||
296 | timeout.tv_usec = 0; | ||
297 | } | ||
267 | 298 | ||
268 | if (es.reason != NEWT_EXIT_HOTKEY) | 299 | err = select(1, &read_set, NULL, NULL, ptimeout); |
300 | if (err > 0 && FD_ISSET(0, &read_set)) | ||
301 | key = newtGetKey(); | ||
302 | else if (err == 0) | ||
269 | break; | 303 | break; |
270 | switch (es.u.key) { | 304 | else { |
305 | pthread_mutex_lock(&ui__lock); | ||
306 | SLtt_get_screen_size(); | ||
307 | SLsmg_reinit_smg(); | ||
308 | pthread_mutex_unlock(&ui__lock); | ||
309 | ui_browser__refresh_dimensions(self); | ||
310 | __ui_browser__show_title(self, self->title); | ||
311 | ui_helpline__puts(self->helpline); | ||
312 | continue; | ||
313 | } | ||
314 | |||
315 | switch (key) { | ||
271 | case NEWT_KEY_DOWN: | 316 | case NEWT_KEY_DOWN: |
272 | if (self->index == self->nr_entries - 1) | 317 | if (self->index == self->nr_entries - 1) |
273 | break; | 318 | break; |
@@ -324,10 +369,8 @@ int ui_browser__run(struct ui_browser *self) | |||
324 | self->seek(self, -offset, SEEK_END); | 369 | self->seek(self, -offset, SEEK_END); |
325 | break; | 370 | break; |
326 | default: | 371 | default: |
327 | return es.u.key; | 372 | return key; |
328 | } | 373 | } |
329 | if (ui_browser__refresh(self) < 0) | ||
330 | return -1; | ||
331 | } | 374 | } |
332 | return -1; | 375 | return -1; |
333 | } | 376 | } |
@@ -353,13 +396,13 @@ unsigned int ui_browser__list_head_refresh(struct ui_browser *self) | |||
353 | return row; | 396 | return row; |
354 | } | 397 | } |
355 | 398 | ||
356 | static struct newtPercentTreeColors { | 399 | static struct ui_browser__colors { |
357 | const char *topColorFg, *topColorBg; | 400 | const char *topColorFg, *topColorBg; |
358 | const char *mediumColorFg, *mediumColorBg; | 401 | const char *mediumColorFg, *mediumColorBg; |
359 | const char *normalColorFg, *normalColorBg; | 402 | const char *normalColorFg, *normalColorBg; |
360 | const char *selColorFg, *selColorBg; | 403 | const char *selColorFg, *selColorBg; |
361 | const char *codeColorFg, *codeColorBg; | 404 | const char *codeColorFg, *codeColorBg; |
362 | } defaultPercentTreeColors = { | 405 | } ui_browser__default_colors = { |
363 | "red", "lightgray", | 406 | "red", "lightgray", |
364 | "green", "lightgray", | 407 | "green", "lightgray", |
365 | "black", "lightgray", | 408 | "black", "lightgray", |
@@ -369,7 +412,7 @@ static struct newtPercentTreeColors { | |||
369 | 412 | ||
370 | void ui_browser__init(void) | 413 | void ui_browser__init(void) |
371 | { | 414 | { |
372 | struct newtPercentTreeColors *c = &defaultPercentTreeColors; | 415 | struct ui_browser__colors *c = &ui_browser__default_colors; |
373 | 416 | ||
374 | sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg); | 417 | sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg); |
375 | sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg); | 418 | sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg); |
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h index d42be43ac0e8..37d56bfe8fe3 100644 --- a/tools/perf/util/ui/browser.h +++ b/tools/perf/util/ui/browser.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _PERF_UI_BROWSER_H_ 1 | 2 | #define _PERF_UI_BROWSER_H_ 1 |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <newt.h> | ||
6 | #include <sys/types.h> | 5 | #include <sys/types.h> |
7 | #include "../types.h" | 6 | #include "../types.h" |
8 | 7 | ||
@@ -13,11 +12,12 @@ | |||
13 | #define HE_COLORSET_CODE 54 | 12 | #define HE_COLORSET_CODE 54 |
14 | 13 | ||
15 | struct ui_browser { | 14 | struct ui_browser { |
16 | newtComponent form, sb; | ||
17 | u64 index, top_idx; | 15 | u64 index, top_idx; |
18 | void *top, *entries; | 16 | void *top, *entries; |
19 | u16 y, x, width, height; | 17 | u16 y, x, width, height; |
20 | void *priv; | 18 | void *priv; |
19 | const char *title; | ||
20 | char *helpline; | ||
21 | unsigned int (*refresh)(struct ui_browser *self); | 21 | unsigned int (*refresh)(struct ui_browser *self); |
22 | void (*write)(struct ui_browser *self, void *entry, int row); | 22 | void (*write)(struct ui_browser *self, void *entry, int row); |
23 | void (*seek)(struct ui_browser *self, off_t offset, int whence); | 23 | void (*seek)(struct ui_browser *self, off_t offset, int whence); |
@@ -40,7 +40,7 @@ int ui_browser__show(struct ui_browser *self, const char *title, | |||
40 | const char *helpline, ...); | 40 | const char *helpline, ...); |
41 | void ui_browser__hide(struct ui_browser *self); | 41 | void ui_browser__hide(struct ui_browser *self); |
42 | int ui_browser__refresh(struct ui_browser *self); | 42 | int ui_browser__refresh(struct ui_browser *self); |
43 | int ui_browser__run(struct ui_browser *self); | 43 | int ui_browser__run(struct ui_browser *browser, int delay_secs); |
44 | void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); | 44 | void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); |
45 | 45 | ||
46 | void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence); | 46 | void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence); |
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c index 674b55e686fd..1967fbf73998 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -196,11 +196,8 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
196 | 196 | ||
197 | nd = self->curr_hot; | 197 | nd = self->curr_hot; |
198 | 198 | ||
199 | if (delay_secs != 0) | ||
200 | newtFormSetTimer(self->b.form, delay_secs * 1000); | ||
201 | |||
202 | while (1) { | 199 | while (1) { |
203 | key = ui_browser__run(&self->b); | 200 | key = ui_browser__run(&self->b, delay_secs); |
204 | 201 | ||
205 | if (delay_secs != 0) { | 202 | if (delay_secs != 0) { |
206 | annotate_browser__calc_percent(self, evidx); | 203 | annotate_browser__calc_percent(self, evidx); |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index fdc3c90696dc..603d6ee5a0d7 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -301,7 +301,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, | |||
301 | void(*timer)(void *arg), void *arg, int delay_secs) | 301 | void(*timer)(void *arg), void *arg, int delay_secs) |
302 | { | 302 | { |
303 | int key; | 303 | int key; |
304 | int delay_msecs = delay_secs * 1000; | ||
305 | char title[160]; | 304 | char title[160]; |
306 | int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, }; | 305 | int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, }; |
307 | int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT, | 306 | int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT, |
@@ -318,15 +317,12 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, | |||
318 | "Press '?' for help on key bindings") < 0) | 317 | "Press '?' for help on key bindings") < 0) |
319 | return -1; | 318 | return -1; |
320 | 319 | ||
321 | if (timer != NULL) | ||
322 | newtFormSetTimer(self->b.form, delay_msecs); | ||
323 | |||
324 | ui_browser__add_exit_keys(&self->b, exit_keys); | 320 | ui_browser__add_exit_keys(&self->b, exit_keys); |
325 | if (self->has_symbols) | 321 | if (self->has_symbols) |
326 | ui_browser__add_exit_keys(&self->b, sym_exit_keys); | 322 | ui_browser__add_exit_keys(&self->b, sym_exit_keys); |
327 | 323 | ||
328 | while (1) { | 324 | while (1) { |
329 | key = ui_browser__run(&self->b); | 325 | key = ui_browser__run(&self->b, delay_secs); |
330 | 326 | ||
331 | switch (key) { | 327 | switch (key) { |
332 | case -1: | 328 | case -1: |
@@ -1061,7 +1057,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, | |||
1061 | void(*timer)(void *arg), void *arg, int delay_secs) | 1057 | void(*timer)(void *arg), void *arg, int delay_secs) |
1062 | { | 1058 | { |
1063 | int exit_keys[] = { NEWT_KEY_ENTER, NEWT_KEY_RIGHT, 0, }; | 1059 | int exit_keys[] = { NEWT_KEY_ENTER, NEWT_KEY_RIGHT, 0, }; |
1064 | int delay_msecs = delay_secs * 1000; | ||
1065 | struct perf_evlist *evlist = menu->b.priv; | 1060 | struct perf_evlist *evlist = menu->b.priv; |
1066 | struct perf_evsel *pos; | 1061 | struct perf_evsel *pos; |
1067 | const char *ev_name, *title = "Available samples"; | 1062 | const char *ev_name, *title = "Available samples"; |
@@ -1071,13 +1066,10 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, | |||
1071 | "ESC: exit, ENTER|->: Browse histograms") < 0) | 1066 | "ESC: exit, ENTER|->: Browse histograms") < 0) |
1072 | return -1; | 1067 | return -1; |
1073 | 1068 | ||
1074 | if (timer != NULL) | ||
1075 | newtFormSetTimer(menu->b.form, delay_msecs); | ||
1076 | |||
1077 | ui_browser__add_exit_keys(&menu->b, exit_keys); | 1069 | ui_browser__add_exit_keys(&menu->b, exit_keys); |
1078 | 1070 | ||
1079 | while (1) { | 1071 | while (1) { |
1080 | key = ui_browser__run(&menu->b); | 1072 | key = ui_browser__run(&menu->b, delay_secs); |
1081 | 1073 | ||
1082 | switch (key) { | 1074 | switch (key) { |
1083 | case -1: | 1075 | case -1: |
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c index 8462bffe20bc..499db76bac2f 100644 --- a/tools/perf/util/ui/browsers/map.c +++ b/tools/perf/util/ui/browsers/map.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "../libslang.h" | 1 | #include "../libslang.h" |
2 | #include <elf.h> | 2 | #include <elf.h> |
3 | #include <newt.h> | ||
3 | #include <inttypes.h> | 4 | #include <inttypes.h> |
4 | #include <sys/ttydefaults.h> | 5 | #include <sys/ttydefaults.h> |
5 | #include <ctype.h> | 6 | #include <ctype.h> |
@@ -112,7 +113,7 @@ static int map_browser__run(struct map_browser *self) | |||
112 | ui_browser__add_exit_key(&self->b, '/'); | 113 | ui_browser__add_exit_key(&self->b, '/'); |
113 | 114 | ||
114 | while (1) { | 115 | while (1) { |
115 | key = ui_browser__run(&self->b); | 116 | key = ui_browser__run(&self->b, 0); |
116 | 117 | ||
117 | if (verbose && key == '/') | 118 | if (verbose && key == '/') |
118 | map_browser__search(self); | 119 | map_browser__search(self); |
diff --git a/tools/perf/util/ui/helpline.h b/tools/perf/util/ui/helpline.h index ab6028d0c401..809975759080 100644 --- a/tools/perf/util/ui/helpline.h +++ b/tools/perf/util/ui/helpline.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PERF_UI_HELPLINE_H_ | 1 | #ifndef _PERF_UI_HELPLINE_H_ |
2 | #define _PERF_UI_HELPLINE_H_ 1 | 2 | #define _PERF_UI_HELPLINE_H_ 1 |
3 | 3 | ||
4 | #include <stdio.h> | ||
5 | |||
4 | void ui_helpline__init(void); | 6 | void ui_helpline__init(void); |
5 | void ui_helpline__pop(void); | 7 | void ui_helpline__pop(void); |
6 | void ui_helpline__push(const char *msg); | 8 | void ui_helpline__push(const char *msg); |