[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1380113447-17144-20-git-send-email-jolsa@redhat.com>
Date: Wed, 25 Sep 2013 14:50:45 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Jiri Olsa <jolsa@...hat.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH 19/21] perf tools: Carry term string value for symbols events
Currently only the number interpretation of the event is
carried for 'value_sym' related events.
We need to have also string symbol representation for toggle
on/off term interface to match the proper event name.
Signed-off-by: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/parse-events.l | 4 +++-
tools/perf/util/parse-events.y | 28 ++++++++++++++++++++--------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 91346b7..560ca86 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -54,8 +54,10 @@ static int str(yyscan_t scanner, int token)
static int sym(yyscan_t scanner, int type, int config)
{
YYSTYPE *yylval = parse_events_get_lval(scanner);
+ char *text = parse_events_get_text(scanner);
- yylval->num = (type << 16) + config;
+ yylval->sym.num = (type << 16) + config;
+ yylval->sym.str = strdup(text);
return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW;
}
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 1497a70..ca93b72 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -48,8 +48,8 @@ static inc_group_count(struct list_head *list,
%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR
%type <num> PE_VALUE
-%type <num> PE_VALUE_SYM_HW
-%type <num> PE_VALUE_SYM_SW
+%type <sym> PE_VALUE_SYM_HW
+%type <sym> PE_VALUE_SYM_SW
%type <num> PE_RAW
%type <num> PE_TERM
%type <str> PE_NAME
@@ -58,7 +58,7 @@ static inc_group_count(struct list_head *list,
%type <str> PE_MODIFIER_EVENT
%type <str> PE_MODIFIER_BP
%type <str> PE_EVENT_NAME
-%type <num> value_sym
+%type <sym> value_sym
%type <head> event_config_optional
%type <head> event_config
%type <term> event_term
@@ -80,8 +80,12 @@ static inc_group_count(struct list_head *list,
%union
{
- char *str;
+ struct {
+ u64 num;
+ char *str;
+ } sym;
u64 num;
+ char *str;
struct list_head *head;
struct parse_events_term *term;
}
@@ -235,8 +239,8 @@ value_sym event_config_optional
struct parse_events_evlist *data = _data;
struct list_head *list;
struct list_head *terms = $2;
- int type = $1 >> 16;
- int config = $1 & 255;
+ int type = $1.num >> 16;
+ int config = $1.num & 255;
ALLOC_LIST(list);
ABORT_ON(parse_events_add_numeric(list, &data->idx,
@@ -384,7 +388,7 @@ PE_NAME '=' PE_VALUE
PE_NAME '=' PE_VALUE_SYM_HW
{
struct parse_events_term *term;
- int config = $3 & 255;
+ int config = $3.num & 255;
ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
$$ = term;
@@ -402,7 +406,7 @@ PE_NAME
PE_VALUE_SYM_HW
{
struct parse_events_term *term;
- int config = $1 & 255;
+ int config = $1.num & 255;
ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
$$ = term;
@@ -416,6 +420,14 @@ PE_TERM '=' PE_NAME
$$ = term;
}
|
+PE_TERM '=' value_sym
+{
+ struct parse_events__term *term;
+
+ ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3.str));
+ $$ = term;
+}
+|
PE_TERM '=' PE_VALUE
{
struct parse_events_term *term;
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists