aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2022-11-07 13:33:08 -0800
committerArnaldo Carvalho de Melo <[email protected]>2022-11-14 13:21:19 -0300
commit81a02c6577ecfee7056ccafbd028984d0d670c0c (patch)
treea0cd3771568c954e0beb8cacbe212055ecc66a3b
parent4ea0be1f0db588afdb2d4d94dfa921b01f34a3c3 (diff)
perf stat: Clear screen only if output file is a tty
The --interval-clear option makes perf stat to clear the terminal at each interval. But it doesn't need to clear the screen when it saves to a file. Signed-off-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Xing Zhengjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/stat-display.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 576283afa319..ccb804546d5a 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -890,7 +890,7 @@ static void print_interval(struct perf_stat_config *config,
FILE *output = config->output;
static int num_print_interval;
- if (config->interval_clear)
+ if (config->interval_clear && isatty(fileno(output)))
puts(CONSOLE_CLEAR);
if (!config->iostat_run && !config->json_output)