linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: mingo@kernel.org, Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, Anton Blanchard <anton@au1.ibm.com>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 2/2] perf: Add support for the mem_xlvl field.
Date: Fri, 7 Jun 2013 13:40:43 -0700	[thread overview]
Message-ID: <20130607204043.GB3281@us.ibm.com> (raw)
In-Reply-To: <20130607204008.GA3281@us.ibm.com>

>From 9f1a8a16e0ef36447e343d1cd4797c2b6a81225f Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date: Fri, 7 Jun 2013 13:26:31 -0700
Subject: [PATCH 2/2] perf: Add support for the mem_xlvl field.

A follow-on patch to adding perf_mem_data_src support for Power7.
At this point, this is only  touch-tested as am looking for feedback
on the main kernel patch.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 tools/perf/util/sort.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5f52d49..24bbf4d 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -631,9 +631,11 @@ static int hist_entry__tlb_snprintf(struct hist_entry *self, char *bf,
 static int64_t
 sort__lvl_cmp(struct hist_entry *left, struct hist_entry *right)
 {
+	int64_t rc;
 	union perf_mem_data_src data_src_l;
 	union perf_mem_data_src data_src_r;
 
+	data_src_l.val = data_src_r.val = (int64_t)0;
 	if (left->mem_info)
 		data_src_l = left->mem_info->data_src;
 	else
@@ -644,7 +646,11 @@ sort__lvl_cmp(struct hist_entry *left, struct hist_entry *right)
 	else
 		data_src_r.mem_lvl = PERF_MEM_LVL_NA;
 
-	return (int64_t)(data_src_r.mem_lvl - data_src_l.mem_lvl);
+	rc = data_src_r.mem_lvl - data_src_l.mem_lvl;
+	if (!rc)
+		rc = data_src_r.mem_xlvl - data_src_l.mem_xlvl;
+		
+	return rc;
 }
 
 static const char * const mem_lvl[] = {
@@ -663,7 +669,14 @@ static const char * const mem_lvl[] = {
 	"I/O",
 	"Uncached",
 };
+
+static const char * const mem_xlvl[] = {
+	"Remote RAM (3 hops)",
+	"Remote Cache (3 hops)",
+};
+
 #define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *))
+#define NUM_MEM_XLVL (sizeof(mem_xlvl)/sizeof(const char *))
 
 static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf,
 				    size_t size, unsigned int width)
@@ -695,6 +708,22 @@ static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf,
 		strncat(out, mem_lvl[i], sz - l);
 		l += strlen(mem_lvl[i]);
 	}
+
+	m = 0;
+	if (self->mem_info)
+		m = self->mem_info->data_src.mem_xlvl;
+
+	for (i = 0; m && i < NUM_MEM_XLVL; i++, m >>= 1) {
+		if (!(m & 0x1))
+			continue;
+		if (l) {
+			strcat(out, " or ");
+			l += 4;
+		}
+		strncat(out, mem_xlvl[i], sz - l);
+		l += strlen(mem_xlvl[i]);
+	}
+
 	if (*out == '\0')
 		strcpy(out, "N/A");
 	if (hit)
-- 
1.7.1

  reply	other threads:[~2013-06-07 20:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 20:40 [PATCH 1/2] perf/Power7: Save dcache_src fields in sample record Sukadev Bhattiprolu
2013-06-07 20:40 ` Sukadev Bhattiprolu [this message]
2013-06-19  4:32   ` [PATCH 2/2] perf: Add support for the mem_xlvl field Michael Neuling
2013-06-10  8:03 ` [PATCH 1/2] perf/Power7: Save dcache_src fields in sample record Anshuman Khandual
2013-06-10 21:48   ` Sukadev Bhattiprolu
2013-06-10 19:34 ` Stephane Eranian
2013-06-10 23:08   ` Sukadev Bhattiprolu
2013-06-19  4:41 ` Michael Neuling
2013-06-19  5:31   ` Sukadev Bhattiprolu

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=20130607204043.GB3281@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=anton@au1.ibm.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@kernel.org \
    --cc=paulus@samba.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).