summaryrefslogtreecommitdiff
path: root/tools/perf/util/stat-display.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-11-08 00:33:13 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-11-14 19:21:19 +0300
commitf1db5a1d1d4de248534567fd95efa570bc693f73 (patch)
tree4a95dddd783cee8985528ecc08129d0bf9e742cf /tools/perf/util/stat-display.c
parent1cc7642abba7b281ecd836bfb56fc6dedac32555 (diff)
downloadlinux-f1db5a1d1d4de248534567fd95efa570bc693f73.tar.xz
perf stat: Fix condition in print_interval()
The num_print_interval and config->interval_clear should be checked together like other places like later in the function. Otherwise, the --interval-clear option could print the headers for the CSV or JSON output unnecessarily. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20221107213314.3239159-9-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat-display.c')
-rw-r--r--tools/perf/util/stat-display.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 2a08c66121ec..7b2ec400813e 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -900,8 +900,8 @@ static void print_interval(struct perf_stat_config *config,
sprintf(prefix, "{\"interval\" : %lu.%09lu}", (unsigned long)
ts->tv_sec, ts->tv_nsec);
- if ((num_print_interval == 0 && !config->csv_output && !config->json_output)
- || config->interval_clear) {
+ if ((num_print_interval == 0 || config->interval_clear) &&
+ !config->csv_output && !config->json_output) {
switch (config->aggr_mode) {
case AGGR_NODE:
fprintf(output, "# time node cpus");