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

From: Namhyung Kim

Date: Wed Aug 12 2026 - 04:49:53 EST


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 <jiebin.sun@xxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
> Cc: Ian Rogers <irogers@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: James Clark <james.clark@xxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Thomas Falcon <thomas.falcon@xxxxxxxxx>
> Reviewed-by: Tianyou Li <tianyou.li@xxxxxxxxx>
> Reviewed-by: Wangyang Guo <wangyang.guo@xxxxxxxxx>
> ---
[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;
> +}