All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 6/7] perf ui hist: Format group headers iteratively based on proportional visual allocations
Date: Mon, 24 Aug 2026 06:53:38 +0000	[thread overview]
Message-ID: <20260824065338.985AA1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260824063744.1533837-7-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Truncation of the `buf` array causes severe visual misalignment of columns when printing group event headers.
--

--- Patch [6]: [PATCH v1 6/7] perf ui hist: Format group headers iteratively based on proportional visual allocations ---
commit fb91b42310113a183352643a9b299c122e218ea8
Author: Ian Rogers <irogers@google.com>

perf ui hist: Format group headers iteratively based on proportional visual allocations

Forcefully calculate proportional visual allocations only natively for
the 'Total' merge target header instead of uniformly ballooning array
spacings. Unpack strings directly into the primary column width fn.

> diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
> index 09f0baa808e0a..02c188100b098 100644
> --- a/tools/perf/ui/hist.c
> +++ b/tools/perf/ui/hist.c

[ ... ]

> @@ -421,8 +458,25 @@ static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
>  	int len = hpp__width_fn(fmt, hpp, hists);
>  	const char *hdr = "";
>  
> -	if (line == hists->hpp_list->nr_header_lines - 1)
> +	if (line == hists->hpp_list->nr_header_lines - 1) {
>  		hdr = fmt->name;
> +		if (hists->merge_entries && &fmt->list == hists->hpp_list->fields.next) {
> +			char buf[1024];
> +			int w = 0;
> +			int f_len = fmt->user_len ?: fmt->len;
> +			struct evsel *pos, *evsel = hists_to_evsel(hists);
> +
> +			w += scnprintf(buf + w, sizeof(buf) - w, "%*.*s", f_len, f_len, fmt->name);
> +			for_each_group_evsel(pos, evsel) {
> +				if (symbol_conf.skip_empty &&
> +			    evsel__hists(pos)->stats.nr_samples == 0)
> +					continue;
> +				w += scnprintf(buf + w, sizeof(buf) - w, " %*.*s",
> +					       f_len - 1, f_len - 1, evsel__name(pos));
> +			}
> +			return scnprintf(hpp->buf, hpp->size, "%*s", len, buf);

[Severity: Medium]
If the event group has many members (e.g., from a hybrid merge), can the
concatenated header string exceed the 1024 byte limit of buf array?

If the array truncates the string, but len is calculated from the total width
of all members, won't this cause the %*s specifier to right-justify the
truncated string within the larger len field?

Could this result in padding the string with leading spaces and cause severe
visual misalignment of columns in the UI output?

> +		}
> +	}
>  
>  	return scnprintf(hpp->buf, hpp->size, "%*s", len, hdr);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824063744.1533837-1-irogers@google.com?part=6

  reply	other threads:[~2026-08-24  6:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 13:25 [PATCH v1] perf top: Merge hybrid common events Andi Kleen
2026-08-13 13:57 ` sashiko-bot
2026-08-17 19:40 ` Ian Rogers
2026-08-18 17:29   ` Andi Kleen
2026-08-19  2:58     ` Ian Rogers
2026-08-19  3:34       ` Andi Kleen
2026-08-19  4:16         ` Ian Rogers
2026-08-19 16:11           ` Andi Kleen
2026-08-19 17:58             ` Ian Rogers
2026-08-19 18:25               ` Andi Kleen
2026-08-19 22:18                 ` Ian Rogers
2026-08-24  6:37 ` [PATCH v1 0/7] perf ui: Implement hybrid event merging for heterogeneous systems Ian Rogers
2026-08-24  6:37   ` [PATCH v1 1/7] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-08-24  6:53     ` sashiko-bot
2026-08-24 22:49     ` Andi Kleen
2026-08-25  4:01       ` Ian Rogers
2026-08-24  6:37   ` [PATCH v1 2/7] perf ui hist: Add support for aggregated total_period and merging entries cleanly Ian Rogers
2026-08-24  6:53     ` sashiko-bot
2026-08-24  6:37   ` [PATCH v1 3/7] perf ui browsers: Implement interactive 'M' keystroke to toggle hybrid event merging Ian Rogers
2026-08-24  6:49     ` sashiko-bot
2026-08-24  6:37   ` [PATCH v1 4/7] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-08-24  6:52     ` sashiko-bot
2026-08-24 22:40     ` Andi Kleen
2026-08-25  3:33       ` Ian Rogers
2026-08-25 22:19         ` Arnaldo Carvalho de Melo
2026-08-24  6:37   ` [PATCH v1 5/7] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-08-24  6:40     ` sashiko-bot
2026-08-24  6:37   ` [PATCH v1 6/7] perf ui hist: Format group headers iteratively based on proportional visual allocations Ian Rogers
2026-08-24  6:53     ` sashiko-bot [this message]
2026-08-24  6:37   ` [PATCH v1 7/7] perf test: Expand top tests for --hybrid-merge Ian Rogers
2026-08-24  6:55     ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824065338.985AA1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.