Re: [PATCH v7 1/2] perf tools c2c: Add annotation support to perf c2c report

From: Ravi Bangoria

Date: Mon Oct 13 2025 - 04:53:01 EST


On 11-Oct-25 1:46 PM, Tianyou Li wrote:
> Perf c2c report currently specified the code address and source:line
> information in the cacheline browser, while it is lack of annotation
> support like perf report to directly show the disassembly code for
> the particular symbol shared that same cacheline. This patches add
> a key 'a' binding to the cacheline browser which reuse the annotation
> browser to show the disassembly view for easier analysis of cacheline
> contentions.

I still see annotate browser title with samples/event count as 0.
Something like below (lightly tested) should fix it. Can you please
check?


--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -299,6 +299,18 @@ static bool perf_c2c__has_annotation(struct perf_hpp_list *list)
return !list || list->sym;
}

+static void perf_c2c__evsel_hists_inc_stats(struct evsel *evsel,
+ struct hist_entry *he,
+ struct perf_sample *sample)
+{
+ struct hists *evsel_hists = evsel__hists(evsel);
+
+ hists__inc_nr_samples(evsel_hists, he->filtered);
+ evsel_hists->stats.total_period += sample->period;
+ if (!he->filtered)
+ evsel_hists->stats.total_non_filtered_period += sample->period;
+}
+
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
@@ -363,6 +375,9 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
hists__inc_nr_samples(&c2c_hists->hists, he->filtered);
if (perf_c2c__has_annotation(NULL))
addr_map_symbol__inc_samples(mem_info__iaddr(mi), sample, evsel);
+
+ perf_c2c__evsel_hists_inc_stats(evsel, he, sample);
+
ret = hist_entry__append_callchain(he, sample);

if (!ret) {

Thanks,
Ravi