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

From: Jiebin Sun

Date: Fri Jul 10 2026 - 04:52:55 EST


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.

> 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.

> 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.

Thanks,
Jiebin