summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-10-15 16:57:48 +0200
committerIngo Molnar <mingo@elte.hu>2011-10-15 16:57:48 +0200
commitc73a3cb356f94b443aa7624b539493191dbf44c1 (patch)
treea813dbd5e3e2cf77ce33729e07f6fda3a819e3bb /tools/perf/builtin-top.c
parentMerge branch 'tip/perf/core' of git://github.com/rostedt/linux into perf/core (diff)
parentperf buildid: Fix possible unterminated readlink() result buffer (diff)
downloadlinux-c73a3cb356f94b443aa7624b539493191dbf44c1.tar.xz
linux-c73a3cb356f94b443aa7624b539493191dbf44c1.zip
Merge branch 'perf/core' of git://github.com/acmel/linux into perf/core
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c5aebf6eb746..e211304a0dd7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -304,7 +304,7 @@ static void print_sym_table(void)
hists__collapse_resort_threaded(&top.sym_evsel->hists);
hists__output_resort_threaded(&top.sym_evsel->hists);
- hists__decay_entries(&top.sym_evsel->hists);
+ hists__decay_entries_threaded(&top.sym_evsel->hists);
hists__output_recalc_col_len(&top.sym_evsel->hists, winsize.ws_row - 3);
putchar('\n');
hists__fprintf(&top.sym_evsel->hists, NULL, false, false,
@@ -555,7 +555,7 @@ static void perf_top__sort_new_samples(void *arg)
hists__collapse_resort_threaded(&t->sym_evsel->hists);
hists__output_resort_threaded(&t->sym_evsel->hists);
- hists__decay_entries(&t->sym_evsel->hists);
+ hists__decay_entries_threaded(&t->sym_evsel->hists);
hists__output_recalc_col_len(&t->sym_evsel->hists, winsize.ws_row - 3);
}
@@ -585,16 +585,31 @@ static void *display_thread(void *arg __used)
tc.c_cc[VMIN] = 0;
tc.c_cc[VTIME] = 0;
+ pthread__unblock_sigwinch();
repeat:
delay_msecs = top.delay_secs * 1000;
tcsetattr(0, TCSANOW, &tc);
/* trash return*/
getc(stdin);
- do {
+ while (1) {
print_sym_table();
- } while (!poll(&stdin_poll, 1, delay_msecs) == 1);
-
+ /*
+ * Either timeout expired or we got an EINTR due to SIGWINCH,
+ * refresh screen in both cases.
+ */
+ switch (poll(&stdin_poll, 1, delay_msecs)) {
+ case 0:
+ continue;
+ case -1:
+ if (errno == EINTR)
+ continue;
+ /* Fall trhu */
+ default:
+ goto process_hotkey;
+ }
+ }
+process_hotkey:
c = getc(stdin);
tcsetattr(0, TCSAFLUSH, &save);