]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf stat: Display metric-only for 0 counters
authorIan Rogers <irogers@google.com>
Wed, 12 Nov 2025 19:53:11 +0000 (11:53 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 18 Nov 2025 01:31:59 +0000 (17:31 -0800)
0 counters may occur in hypervisor settings but metric-only output is
always expected. This resolves an issue in the "perf stat STD output
linter" test.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/stat-display.c

index 5ac9854f8c585559a17b3181a4093f4a444877cc..6d02f84c5691a434487e9e428c4a7a30f1c76305 100644 (file)
@@ -913,6 +913,9 @@ static bool should_skip_zero_counter(struct perf_stat_config *config,
        if (verbose == 0 && counter->skippable && !counter->supported)
                return true;
 
+       /* Metric only counts won't be displayed but the metric wants to be computed. */
+       if (config->metric_only)
+               return false;
        /*
         * Skip value 0 when enabling --per-thread globally,
         * otherwise it will have too many 0 output.