From: Jiri Olsa <jolsa@redhat.com>
To: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
paulus@samba.org, cjashfor@linux.vnet.ibm.com,
fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
andi@firstfloor.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 1/8] perf, tool: Add support to parse event group syntax
Date: Wed, 4 Apr 2012 23:16:09 +0200 [thread overview]
Message-ID: <1333574176-11388-2-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1333574176-11388-1-git-send-email-jolsa@redhat.com>
Adding scanner/parser bits to add group event support into the
event syntax.
The grammar for group is:
start: groups
groups: groups ';' group
group: 'group=' events
It is possible to specify group assignement in event syntax like:
perf record -e group=cycles,faults ls
Creating multiple events within one '-e' option with the ';' separator:
perf record -e 'group=cycles,faults;group=instructions,cache-misses' ls
The grouping functionality itself is comming in shortly.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/parse-events.c | 5 +++
tools/perf/util/parse-events.h | 1 +
tools/perf/util/parse-events.l | 2 +
tools/perf/util/parse-events.y | 55 ++++++++++++++++++++++++++++++++++-----
4 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d4abd00..53c7505 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -791,6 +791,11 @@ int parse_events_add_pmu(struct list_head **list, int *idx,
return add_event(list, idx, &attr, name);
}
+int parse_events__group(struct list_head *list __used)
+{
+ return 0;
+}
+
void parse_events_update_lists(struct list_head *list_event,
struct list_head *list_all)
{
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 8651757..a5e1adf 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -99,6 +99,7 @@ int parse_events_add_breakpoint(struct list_head **list, int *idx,
void *ptr, char *type);
int parse_events_add_pmu(struct list_head **list, int *idx,
char *pmu , struct list_head *head_config);
+int parse_events__group(struct list_head *list);
void parse_events_update_lists(struct list_head *list_event,
struct list_head *list_all);
void parse_events_error(struct list_head *list_all,
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index cd6614d..c867b34 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -107,6 +107,7 @@ period { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
branch_type { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
mem: { return PE_PREFIX_MEM; }
+group= { return PE_PREFIX_GROUP; }
r{num_raw_hex} { return raw(); }
{num_dec} { return value(10); }
{num_hex} { return value(16); }
@@ -118,6 +119,7 @@ r{num_raw_hex} { return raw(); }
- { return '-'; }
, { return ','; }
: { return ':'; }
+; { return ';'; }
= { return '='; }
\| { return '|'; }
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 5899a0e..a3898d6 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -27,7 +27,7 @@ do { \
%token PE_NAME
%token PE_MODIFIER_EVENT PE_MODIFIER_BP
%token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
-%token PE_PREFIX_MEM PE_PREFIX_RAW
+%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR
%type <num> PE_VALUE
%type <num> PE_VALUE_SYM
@@ -50,6 +50,10 @@ do { \
%type <head> event_legacy_numeric
%type <head> event_legacy_raw
%type <head> event_def
+%type <head> event
+%type <head> events
+%type <head> group
+%type <head> groups
%union
{
@@ -61,25 +65,62 @@ do { \
}
%%
+start: groups
+{
+ struct list_head *groups = $1;
+
+ parse_events_update_lists(groups, list_all);
+}
+
+groups:
+groups ';' group
+{
+ struct list_head *group = $3;
+ struct list_head *list = $1;
+
+ parse_events_update_lists(group, list);
+ $$ = list;
+}
+|
+group
+
+group:
+PE_PREFIX_GROUP events
+{
+ struct list_head *list = $2;
+
+ ABORT_ON(parse_events__group(list));
+ $$ = list;
+}
+|
+events
+
events:
-events ',' event | event
+events ',' event
+{
+ struct list_head *event = $3;
+ struct list_head *list = $1;
+
+ parse_events_update_lists(event, list);
+ $$ = list;
+}
+|
+event
event:
event_def PE_MODIFIER_EVENT
{
+ struct list_head *list = $1;
/*
* Apply modifier on all events added by single event definition
* (there could be more events added for multiple tracepoint
* definitions via '*?'.
*/
- ABORT_ON(parse_events_modifier($1, $2));
- parse_events_update_lists($1, list_all);
+ ABORT_ON(parse_events_modifier(list, $2));
+ $$ = list;
}
|
event_def
-{
- parse_events_update_lists($1, list_all);
-}
event_def: event_pmu |
event_legacy_symbol |
--
1.7.7.6
next prev parent reply other threads:[~2012-04-04 21:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-04 21:16 [RFCv2 0/8] perf tool: Add new event group management Jiri Olsa
2012-04-04 21:16 ` Jiri Olsa [this message]
2012-04-04 21:16 ` [PATCH 2/8] perf, tool: Enable grouping logic for parsed events Jiri Olsa
2012-04-04 21:16 ` [PATCH 3/8] perf: Add PERF_EVENT_IOC_ID ioctl to return event ID Jiri Olsa
2012-04-04 21:16 ` [PATCH 4/8] perf, tool: Use PERF_EVENT_IOC_ID perf ioctl to read event id Jiri Olsa
2012-04-04 21:16 ` [PATCH 5/8] perf, tool: Separate 'mem:' event scanner bits Jiri Olsa
2012-04-11 13:28 ` Robert Richter
2012-04-11 14:33 ` Jiri Olsa
2012-04-13 17:02 ` Robert Richter
2012-04-04 21:16 ` [PATCH 6/8] perf, tool: Add modifier support to group event syntax Jiri Olsa
2012-04-04 21:16 ` [PATCH 7/8] perf, tool: Add support for parsing PERF_SAMPLE_READ Jiri Olsa
2012-04-04 21:16 ` [PATCH 8/8] perf, tool: Enable sampling on specified event group leader Jiri Olsa
2012-04-04 21:21 ` [RFCv2 0/8] perf tool: Add new event group management Jiri Olsa
2012-04-15 15:16 ` Peter Zijlstra
2012-04-16 12:16 ` Jiri Olsa
2012-04-16 14:23 ` Peter Zijlstra
2012-04-16 15:26 ` Peter Zijlstra
2012-04-16 15:37 ` Jiri Olsa
2012-04-17 2:16 ` Namhyung Kim
2012-04-17 9:09 ` Namhyung Kim
2012-04-17 9:33 ` Jiri Olsa
2012-05-25 22:36 ` Andi Kleen
2012-05-26 12:38 ` Jiri Olsa
2012-05-26 19:23 ` Andi Kleen
2012-05-27 7:56 ` Ulrich Drepper
2012-05-27 15:08 ` Andi Kleen
2012-05-28 19:21 ` Jiri Olsa
2012-05-29 8:39 ` Peter Zijlstra
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=1333574176-11388-2-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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