From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com,
acme@redhat.com, jolsa@redhat.com
Subject: [PATCH v2 1/2] perf tools: add event modifier to request exclusive PMU access
Date: Mon, 22 Oct 2012 15:20:51 +0200 [thread overview]
Message-ID: <1350912052-10066-2-git-send-email-eranian@google.com> (raw)
In-Reply-To: <1350912052-10066-1-git-send-email-eranian@google.com>
This patch adds the x modifier for events. It allows users to
request exclusive PMU access (attr->exclusive):
perf stat -e cycles:x ......
or
perf stat -e cpu/cycles/x ....
Exclusive mode is a feature of perf_events which was not yet
supported by the perf tool. Some events may require exclusive
PMU access (like on Intel SandyBridge).
In V2, we fixed the max repeat factor for the event
modifier. Must be 9 not 8.
Signed-off-by: Stephane Eranian <eranian@google.com>
---
tools/perf/util/parse-events.c | 7 +++++++
tools/perf/util/parse-events.l | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index aed38e4..aa73392 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -642,6 +642,7 @@ struct event_modifier {
int eG;
int precise;
int exclude_GH;
+ int exclusive;
};
static int get_event_modifier(struct event_modifier *mod, char *str,
@@ -656,6 +657,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
int exclude = eu | ek | eh;
int exclude_GH = evsel ? evsel->exclude_GH : 0;
+ int exclusive = evsel ? evsel->attr.exclusive : 0;
/*
* We are here for group and 'GH' was not set as event
@@ -690,6 +692,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
eH = 0;
} else if (*str == 'p') {
precise++;
+ } else if (*str == 'x') {
+ exclusive = 1;
} else
break;
@@ -716,6 +720,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
mod->eG = eG;
mod->precise = precise;
mod->exclude_GH = exclude_GH;
+ mod->exclusive = exclusive;
+
return 0;
}
@@ -741,6 +747,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
evsel->attr.precise_ip = mod.precise;
evsel->attr.exclude_host = mod.eH;
evsel->attr.exclude_guest = mod.eG;
+ evsel->attr.exclusive = mod.exclusive;
evsel->exclude_GH = mod.exclude_GH;
}
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c87efc1..9c8a06d 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -81,7 +81,7 @@ num_dec [0-9]+
num_hex 0x[a-fA-F0-9]+
num_raw_hex [a-fA-F0-9]+
name [a-zA-Z_*?][a-zA-Z0-9_*?]*
-modifier_event [ukhpGH]{1,8}
+modifier_event [ukhpGHx]{1,9}
modifier_bp [rwx]{1,3}
%%
--
1.7.9.5
next prev parent reply other threads:[~2012-10-22 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 13:20 [PATCH v2 0/2] perf: enforce exclusive PMU access for SNB INST_RETIRED:PREC_DIST Stephane Eranian
2012-10-22 13:20 ` Stephane Eranian [this message]
2012-10-22 13:53 ` [PATCH v2 1/2] perf tools: add event modifier to request exclusive PMU access Andi Kleen
2012-10-22 14:55 ` Stephane Eranian
2012-10-22 15:39 ` Andi Kleen
2012-10-22 15:44 ` Stephane Eranian
2012-10-22 15:59 ` Peter Zijlstra
2012-10-22 16:08 ` Stephane Eranian
2012-10-22 17:08 ` Peter Zijlstra
2012-10-22 13:20 ` [PATCH v2 2/2] perf: enforce SNB exclusive access for INST_RETIRED:PREC_DIST Stephane Eranian
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=1350912052-10066-2-git-send-email-eranian@google.com \
--to=eranian@google.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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
Powered by JetHome