mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Ingo Molnar <mingo@elte.hu>, Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] perf_counter: tools: Make :u and :k exclude hypervisor
Date: Mon, 29 Jun 2009 21:08:26 +1000	[thread overview]
Message-ID: <19016.41130.429944.316897@cargo.ozlabs.ibm.com> (raw)

At present, appending ":u" to an event sets the exclude_kernel bit,
and ":k" sets the exclude_user bit.  There is no way to set the
exclude_hv bit, which means that on systems with a hypervisor (e.g.
IBM pSeries systems), we get counts from hypervisor mode for an event
such as 0:1:u.

This fixes the problem by setting all three exclude bits when we see
the second ':' and the clearing the exclude bits corresponding to the
modes we want to count.  This also adds a ":h" modifier to allow the
user to ask for counts in hypervisor mode.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 tools/perf/util/parse-events.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4d042f1..f2ffe2c 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -277,10 +277,15 @@ static int parse_event_symbols(const char *str, struct perf_counter_attr *attr)
 		sep = strchr(pstr, ':');
 		if (sep) {
 			pstr = sep + 1;
+			attr->exclude_user = 1;
+			attr->exclude_kernel = 1;
+			attr->exclude_hv = 1;
 			if (strchr(pstr, 'k'))
-				attr->exclude_user = 1;
+				attr->exclude_kernel = 0;
 			if (strchr(pstr, 'u'))
-				attr->exclude_kernel = 1;
+				attr->exclude_user = 0;
+			if (strchr(pstr, 'h'))
+				attr->exclude_hv = 0;
 		}
 		attr->type = type;
 		attr->config = id;
-- 
1.6.0.4


             reply	other threads:[~2009-06-29 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29 11:08 Paul Mackerras [this message]
2009-06-29 11:13 ` [PATCH 2/2] perf_counter: tools: Reduce perf stat overhead Paul Mackerras
2009-06-29 20:51   ` [tip:perfcounters/urgent] perf_counter tools: Reduce perf stat measurement overhead/skew tip-bot for Paul Mackerras
2009-06-29 20:34 ` [PATCH 1/2] perf_counter: tools: Make :u and :k exclude hypervisor Ingo Molnar
2009-06-30 11:35   ` Paul Mackerras
2009-06-30 11:57     ` Ingo Molnar

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=19016.41130.429944.316897@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=a.p.zijlstra@chello.nl \
    --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

all inboxes | Powered by JetHome®