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