lkml.org 
[lkml]   [2022]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/9] perf stat: Clear screen only if output file is a tty
Date
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 <namhyung@kernel.org>
---
tools/perf/util/stat-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 17d656566cd9..d4936a502560 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -892,7 +892,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)
--
2.38.1.431.g37b22c650d-goog
\
 
 \ /
  Last update: 2022-11-07 22:33    [W:0.174 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site