perf stat: Move condition to print_footer()
authorNamhyung Kim <namhyung@kernel.org>
Mon, 14 Nov 2022 23:02:23 +0000 (15:02 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 16 Nov 2022 12:51:23 +0000 (09:51 -0300)
Likewise, I think it'd better to have the control inside the function, and keep
the higher level function clearer.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.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/20221114230227.1255976-16-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/stat-display.c

index f978176..73cf898 100644 (file)
@@ -1205,6 +1205,9 @@ static void print_footer(struct perf_stat_config *config)
        double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC;
        FILE *output = config->output;
 
+       if (config->interval || config->csv_output || config->json_output)
+               return;
+
        if (!config->null_run)
                fprintf(output, "\n");
 
@@ -1359,8 +1362,7 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
                break;
        }
 
-       if (!interval && !config->csv_output && !config->json_output)
-               print_footer(config);
+       print_footer(config);
 
        fflush(config->output);
 }