aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2012-01-30 05:50:37 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-01-30 15:30:10 -0500
commit008953dc6a3164b7ec2be2684a8fad1e636d5648 (patch)
treec7b78ca8a747ecd75ae048651fdacb66465f94c8 /tools
parent0bc8d20580af74c9a8a39c200e269261e5cded05 (diff)
perf top: Fix number of samples displayed
In recent versions of perf top, pressing the 'e' key to change the number of displayed samples had no effect. The number of samples was still dictated by the size of the terminal (stdio mode). That was quite annoying because typically only the first dozen samples really matter. This patch fixes this. Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120130105037.GA5160@quad Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-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) {