diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-top.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 8f80df896038..dd162aa24baa 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -89,8 +89,6 @@ void get_term_dimensions(struct winsize *ws) | |||
89 | 89 | ||
90 | static void perf_top__update_print_entries(struct perf_top *top) | 90 | static void perf_top__update_print_entries(struct perf_top *top) |
91 | { | 91 | { |
92 | top->print_entries = top->winsize.ws_row; | ||
93 | |||
94 | if (top->print_entries > 9) | 92 | if (top->print_entries > 9) |
95 | top->print_entries -= 9; | 93 | top->print_entries -= 9; |
96 | } | 94 | } |
@@ -100,6 +98,13 @@ static void perf_top__sig_winch(int sig __used, siginfo_t *info __used, void *ar | |||
100 | struct perf_top *top = arg; | 98 | struct perf_top *top = arg; |
101 | 99 | ||
102 | get_term_dimensions(&top->winsize); | 100 | get_term_dimensions(&top->winsize); |
101 | if (!top->print_entries | ||
102 | || (top->print_entries+4) > top->winsize.ws_row) { | ||
103 | top->print_entries = top->winsize.ws_row; | ||
104 | } else { | ||
105 | top->print_entries += 4; | ||
106 | top->winsize.ws_row = top->print_entries; | ||
107 | } | ||
103 | perf_top__update_print_entries(top); | 108 | perf_top__update_print_entries(top); |
104 | } | 109 | } |
105 | 110 | ||
@@ -453,8 +458,10 @@ static void perf_top__handle_keypress(struct perf_top *top, int c) | |||
453 | }; | 458 | }; |
454 | perf_top__sig_winch(SIGWINCH, NULL, top); | 459 | perf_top__sig_winch(SIGWINCH, NULL, top); |
455 | sigaction(SIGWINCH, &act, NULL); | 460 | sigaction(SIGWINCH, &act, NULL); |
456 | } else | 461 | } else { |
462 | perf_top__sig_winch(SIGWINCH, NULL, top); | ||
457 | signal(SIGWINCH, SIG_DFL); | 463 | signal(SIGWINCH, SIG_DFL); |
464 | } | ||
458 | break; | 465 | break; |
459 | case 'E': | 466 | case 'E': |
460 | if (top->evlist->nr_entries > 1) { | 467 | if (top->evlist->nr_entries > 1) { |