aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-13 07:52:46 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-13 07:52:46 -0400
commit3af6e33867b3814a73c3f3ba991a13d7304ad23a (patch)
tree28f0f4071736faca07252439a0037e27f0895a53 /tools/perf/builtin-top.c
parent33e27312aeb05798572ccc456a76321125e8d7cb (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>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c21
1 files changed, 18 insertions, 3 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();
588repeat: 589repeat:
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 }
612process_hotkey:
598 c = getc(stdin); 613 c = getc(stdin);
599 tcsetattr(0, TCSAFLUSH, &save); 614 tcsetattr(0, TCSAFLUSH, &save);
600 615