Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755799Ab3IYMvy (ORCPT ); Wed, 25 Sep 2013 08:51:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3245 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755772Ab3IYMvu (ORCPT ); Wed, 25 Sep 2013 08:51:50 -0400 From: Jiri Olsa To: linux-kernel@vger.kernel.org Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Corey Ashford , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Peter Zijlstra Subject: [PATCH 19/21] perf tools: Carry term string value for symbols events Date: Wed, 25 Sep 2013 14:50:45 +0200 Message-Id: <1380113447-17144-20-git-send-email-jolsa@redhat.com> In-Reply-To: <1380113447-17144-1-git-send-email-jolsa@redhat.com> References: <1380113447-17144-1-git-send-email-jolsa@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3651 Lines: 125 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 Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo --- 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 PE_VALUE -%type PE_VALUE_SYM_HW -%type PE_VALUE_SYM_SW +%type PE_VALUE_SYM_HW +%type PE_VALUE_SYM_SW %type PE_RAW %type PE_TERM %type PE_NAME @@ -58,7 +58,7 @@ static inc_group_count(struct list_head *list, %type PE_MODIFIER_EVENT %type PE_MODIFIER_BP %type PE_EVENT_NAME -%type value_sym +%type value_sym %type event_config_optional %type event_config %type 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/