[RFT PATCH 2/7] perf stat: Save unnecessary print_metric() call
Yushan Wang
wangyushan12 at huawei.com
Mon Jan 26 04:35:09 PST 2026
Patch [1] removed the second branch of iostat_run, and changed num to 0
since it is the default behavior. But during iostat_run, default value 1
of num is required to avoid print_metric() call later.
Set num as 1 to avoid redundant print_metric() call that causes
unaligned blank printed.
Fixes: b71f46a6a708 ("perf stat: Remove hard coded shadow metrics")
[1]: https://lore.kernel.org/all/20251111212206.631711-8-irogers@google.com/
Signed-off-by: Yushan Wang <wangyushan12 at huawei.com>
---
tools/perf/util/stat-shadow.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 9c83f7d96caa..9439baf8002f 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -319,8 +319,10 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
void *ctxp = out->ctx;
int num = 0;
- if (config->iostat_run)
+ if (config->iostat_run) {
iostat_print_metric(config, evsel, out);
+ num = 1;
+ }
perf_stat__print_shadow_stats_metricgroup(config, evsel, aggr_idx,
&num, NULL, out);
--
2.33.0
More information about the linux-arm-kernel
mailing list