[RFT PATCH 2/7] perf stat: Save unnecessary print_metric() call
Jonathan Cameron
jonathan.cameron at huawei.com
Tue Jan 27 08:01:18 PST 2026
On Mon, 26 Jan 2026 20:35:09 +0800
Yushan Wang <wangyushan12 at huawei.com> wrote:
> 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/
Use a Link tag for links, but don't add them when they just point to the patch
you already have as a fixes tag. Just refer to it as "The patch listed under
Fixes".
>
> 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);
More information about the linux-arm-kernel
mailing list