From: Ian Rogers Date: Wed, 12 Nov 2025 19:53:11 +0000 (-0800) Subject: perf stat: Display metric-only for 0 counters X-Git-Tag: v6.19-rc1~61^2~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=289815011c91dc6532d3fff7ca1c5f0bea08b474;p=thirdparty%2Flinux.git perf stat: Display metric-only for 0 counters 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 Tested-by: Thomas Falcon Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 5ac9854f8c585..6d02f84c5691a 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -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.