diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index f6dd1a63f159e970041d8614b0d0223cdf4a8048..d2539b793f9d4fb8ae7299f0183217529d5525d9 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -684,7 +684,9 @@ static void *display_thread(void *arg) delay_msecs = top->delay_secs * MSEC_PER_SEC; set_term_quiet_input(&save); /* trash return*/ - getc(stdin); + clearerr(stdin); + if (poll(&stdin_poll, 1, 0) > 0) + getc(stdin); while (!done) { perf_top__print_sym_table(top);