linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org, acme@redhat.com,
	irogers@google.com, namhyung@kernel.org
Cc: jmario@redhat.com, jolsa@kernel.org
Subject: [PATCH 3/4] perf c2c: Add map name for cacheline
Date: Mon,  6 Oct 2025 19:57:09 +0200	[thread overview]
Message-ID: <20251006175710.1179040-4-mpetlan@redhat.com> (raw)
In-Reply-To: <20251006175710.1179040-1-mpetlan@redhat.com>

Add column showing address range of the entries in Shared Data Cache
Line Table.

Suggested-by: Joe Mario <jmario@redhat.com>
Suggested-by: Jiri Olsa <jolsa@kernel.org>

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/builtin-c2c.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index ab77ea7b188c..78bcc18b7891 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -1368,6 +1368,28 @@ cl_shared_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 	return scnprintf(hpp->buf, hpp->size, "%*s", width, buf);
 }
 
+static int
+cl_map_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
+			 struct hist_entry *he)
+{
+	struct c2c_hist_entry *c2c_he;
+	int width = c2c_width(fmt, hpp, he->hists);
+	char buf[100];
+	struct map *map = he->mem_info->daddr.ms.map;
+
+	c2c_he = container_of(he, struct c2c_hist_entry, he);
+	c2c_he__resolve_shared_mem(c2c_he);
+
+	if (map) {
+		scnprintf(buf, 100, "%lx-%lx %s", map->start, map->end,
+				  map->dso ? map->dso->name : "N/A");
+	} else {
+		scnprintf(buf, 100, "N/A");
+	}
+
+	return scnprintf(hpp->buf, hpp->size, "%*s", width, buf);
+}
+
 #define HEADER_LOW(__h)			\
 	{				\
 		.line[1] = {		\
@@ -1856,6 +1878,14 @@ static struct c2c_dimension dim_dcacheline_shared = {
 	.width		= 1,
 };
 
+static struct c2c_dimension dim_dcacheline_map = {
+	.header		= HEADER_LOW("Map"),
+	.name		= "cl_map",
+	.cmp		= empty_cmp,
+	.entry		= cl_map_entry,
+	.width		= 3,
+};
+
 static struct c2c_dimension *dimensions[] = {
 	&dim_dcacheline,
 	&dim_dcacheline_node,
@@ -1913,6 +1943,7 @@ static struct c2c_dimension *dimensions[] = {
 	&dim_dcacheline_num,
 	&dim_dcacheline_num_empty,
 	&dim_dcacheline_shared,
+	&dim_dcacheline_map,
 	NULL,
 };
 
@@ -3210,7 +3241,7 @@ static int perf_c2c__report(int argc, const char **argv)
 			     "ld_fbhit,ld_l1hit,ld_l2hit,"
 			     "ld_lclhit,lcl_hitm,"
 			     "ld_rmthit,rmt_hitm,"
-			     "dram_lcl,dram_rmt";
+			     "dram_lcl,dram_rmt,cl_map";
 	else
 		output_str = "cl_idx,"
 			     "cl_shared,"
@@ -3226,7 +3257,7 @@ static int perf_c2c__report(int argc, const char **argv)
 			     "ld_fbhit,ld_l1hit,ld_l2hit,"
 			     "ld_lclhit,lcl_hitm,"
 			     "ld_rmthit,rmt_hitm,"
-			     "dram_lcl,dram_rmt";
+			     "dram_lcl,dram_rmt,cl_map";
 
 	if (c2c.display == DISPLAY_TOT_HITM)
 		sort_str = "tot_hitm";
-- 
2.47.3


  parent reply	other threads:[~2025-10-06 17:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06 17:57 [PATCH 0/4] perf c2c: Detect shared memory cachelines Michael Petlan
2025-10-06 17:57 ` [PATCH 1/4] perf tools: Remove /SYSV from no_dso maps Michael Petlan
2025-10-06 18:01   ` Ian Rogers
2025-10-06 18:28     ` Joe Mario
2025-10-06 19:21       ` Ian Rogers
2025-10-06 17:57 ` [PATCH 2/4] perf c2c: Add shared mem flag Michael Petlan
2025-10-06 17:57 ` Michael Petlan [this message]
2025-10-06 17:57 ` [PATCH 4/4] perf c2c report: Add --detect-shm option Michael Petlan
2025-10-07  8:16 ` [PATCH 0/4] perf c2c: Detect shared memory cachelines Namhyung Kim
2025-10-07 14:38   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251006175710.1179040-4-mpetlan@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@redhat.com \
    --cc=irogers@google.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).