Re: [PATCH 00/14] perf c2c: add a function view

From: Namhyung Kim

Date: Fri Jul 10 2026 - 17:56:12 EST


Hello,

On Fri, Jul 10, 2026 at 04:49:20PM +0800, Jiebin Sun wrote:
> Hi Namhyung,
>
> Thank you very much for the review and the suggestions.
>
> > It'd be great if you can add this to the documentation.
>
> Sure. I've added the worked example to
> tools/perf/Documentation/perf-c2c.txt in the v2 I just sent.

Thanks!

>
> > Any chance it can share the code? We have `perf mem report` as well,
> > which deals with similar kind of data.
>
> The function view does reuse the common infrastructure: it shares the
> c2c data structures (moved into c2c.h), the perf_hpp_fmt column
> framework, hists__collapse_resort()/hists__output_resort(),
> hists__add_entry_ops() for dedup, and the hist_browser (including the
> generic fold/expand handling).
>
> The part it does not reuse is the generic report hierarchy builder. That
> nests a single sample's own sort keys, while the function view pairs
> functions that share a cacheline -- the entries are (function A,
> function B) pairs that don't map to one sample. That's why the hierarchy
> is built explicitly rather than from a sort-key list.

I see. Yeah I think it's a different model but it may be possible to
have a cacheline in a parent node and functions that accessed it in
the children.

>
> > Also data type profiling would give more meaningful data once DWARF is
> > available. It'd be nice if c2c could support the type analysis or c2c
> > could be implemented on top of `perf mem report` which already supports
> > the data type profiling.
>
> Agreed, data-type profiling is a great fit here -- naming the exact
> struct field being contended is often the most actionable part of a
> false-sharing fix. I'd like to explore this as a follow-up after this
> series, reusing perf mem report's type/typeoff support to add a "which
> data structure" view to c2c.

Sounds good.

Thanks,
Namhyung