Re: [PATCH v8 3/9] perf c2c: add column rendering for function view

Namhyung Kim <[email protected]>
Newsgroups org.kernel.vger.linux-perf-users,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Mon, Aug 10, 2026 at 01:26:41PM +0800, Jiebin Sun wrote:
> Add renderers for the function view's Cycles %, Store count, and
> hierarchy identity columns. The identity column renders the read-side
> function, contending writer, or cacheline, with indentation for the
> hierarchy level. Also add width and header helpers, estimated-cycle
> calculation, comparators, and the dimension table that ties them together.
> 
> Clamp the identity renderer's returned length to its local buffer before
> using it for pointer and padding calculations. This handles snprintf-style
> would-have-been lengths without changing normal output.
> 
> The next patch connects these dimensions to the view's HPP lists, so the
> symbols used only there are temporarily marked __maybe_unused.
> 
> Signed-off-by: Jiebin Sun <[email protected]>
> Cc: Adrian Hunter <[email protected]>
> Cc: Alexander Shishkin <[email protected]>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Cc: Dapeng Mi <[email protected]>
> Cc: Ian Rogers <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: James Clark <[email protected]>
> Cc: Jiri Olsa <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Thomas Falcon <[email protected]>
> Reviewed-by: Tianyou Li <[email protected]>
> Reviewed-by: Wangyang Guo <[email protected]>
> ---
[SNIP]
> +/*
> + * Store count shown in the column: a level-3 cacheline leaf shows its parent
> + * level-2 writer's stores on that line, not all stores on the line. A level-2
> + * writer shows the sum across its level-3 cachelines. A level-1 reader shows
> + * the sum across all included writers on the cachelines it reads; this is not
> + * the reader function's own store count and is not additive across readers.
> + */
> +static u64 hist_entry__displayed_stores(struct hist_entry *he)
> +{
> +	struct c2c_hist_entry *c2c_he = container_of(he, struct c2c_hist_entry, he);
> +	struct rb_node *nd;
> +	u64 stores = 0;
> +
> +	/* Level-2/3 entries already aggregate the stores they represent. */
> +	if (he->parent_he)
> +		return c2c_he->stats.store;
> +
> +	for (nd = rb_first_cached(&he->hroot_out); nd; nd = rb_next(nd)) {
> +		struct hist_entry *child = rb_entry(nd, struct hist_entry, rb_node);
> +		struct c2c_hist_entry *child_c2c;
> +
> +		child_c2c = container_of(child, struct c2c_hist_entry, he);

Can it be simplified like this?

		struct c2c_hist_entry *child_c2c = rb_entry(nd, struct c2c_hist_entry, he.rb_node);

Thanks,
Namhyung


> +		stores += child_c2c->stats.store;
> +	}
> +	return stores;
> +}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.