public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <andi@firstfloor.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>
Subject: [RFC PATCH 3/3 v2] perf: Update perf tool to monitor uncore events
Date: Sun, 21 Nov 2010 20:01:47 +0800	[thread overview]
Message-ID: <1290340907.2245.125.camel@localhost> (raw)

Uncore events are monitored with raw events with "ru" prefix("u" for uncore).

$ ./perf stat -C 0 -e ru0101 -- ls

 Performance counter stats for 'ls':

            1033791  raw 0x101               

        0.003027583  seconds time elapsed

$ sudo ./perf top -e ru0101

--------------------------------------------------------------------------------------------------------------------
   PerfTop:      22 irqs/sec  kernel:68.2%  exact:  0.0% [1000Hz raw 0x101],  (all, 8 CPUs)
--------------------------------------------------------------------------------------------------------------------

             samples  pcnt function               DSO
             _______ _____ ______________________ ____________________________________

                8.00 18.6% kallsyms_expand_symbol [kernel.kallsyms]                   
                5.00 11.6% rb_next                /home/mlin/linux-2.6/tools/perf/perf
                5.00 11.6% clear_page_c           [kernel.kallsyms]

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 tools/perf/util/parse-events.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 898aa94..b03457a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -278,7 +278,7 @@ const char *__event_name(int type, u64 config)
 {
 	static char buf[32];
 
-	if (type == PERF_TYPE_RAW) {
+	if (type == PERF_TYPE_RAW || type == PERF_TYPE_UNCORE) {
 		sprintf(buf, "raw 0x%llx", config);
 		return buf;
 	}
@@ -655,14 +655,20 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr)
 {
 	const char *str = *strp;
 	u64 config;
+	int uncore = 0;
 	int n;
 
 	if (*str != 'r')
 		return EVT_FAILED;
-	n = hex2u64(str + 1, &config);
+	if (*(str+1) == 'u')
+		uncore = 1;
+	n = hex2u64(str + 1 + uncore, &config);
 	if (n > 0) {
-		*strp = str + n + 1;
-		attr->type = PERF_TYPE_RAW;
+		*strp = str + n + 1 + uncore;
+		if (!uncore)
+			attr->type = PERF_TYPE_RAW;
+		else
+			attr->type = PERF_TYPE_UNCORE;
 		attr->config = config;
 		return EVT_HANDLED;
 	}
-- 
1.7.2.3






             reply	other threads:[~2010-11-21 12:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-21 12:01 Lin Ming [this message]
2010-11-21 12:09 ` [RFC PATCH 3/3 v2] perf: Update perf tool to monitor uncore events Andi Kleen
2010-11-21 12:22   ` Stephane Eranian
2010-11-21 14:19     ` Lin Ming
2010-11-21 16:52     ` Andi Kleen
2010-11-23  9:18       ` Stephane Eranian
2010-11-21 17:45     ` Peter Zijlstra
2010-11-21 18:28       ` Andi Kleen
2010-11-21 18:30         ` Peter Zijlstra
2010-11-21 14:12   ` Lin Ming

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=1290340907.2245.125.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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