linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, hpa@zytor.com, paulus@samba.org,
	tglx@linutronix.de, linux-kernel@vger.kernel.org,
	mingo@kernel.org, jolsa@kernel.org, dsahern@gmail.com,
	a.p.zijlstra@chello.nl, namhyung@kernel.org
Subject: [tip:perf/core] perf tools: Add symbolic events support for parse_events_error
Date: Tue, 5 May 2015 20:06:23 -0700	[thread overview]
Message-ID: <tip-87d650be1dcc9bd9bb200e73b985ddb740d067bc@git.kernel.org> (raw)
In-Reply-To: <1429729824-13932-10-git-send-email-jolsa@kernel.org>

Commit-ID:  87d650be1dcc9bd9bb200e73b985ddb740d067bc
Gitweb:     http://git.kernel.org/tip/87d650be1dcc9bd9bb200e73b985ddb740d067bc
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 22 Apr 2015 21:10:24 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 29 Apr 2015 10:38:02 -0300

perf tools: Add symbolic events support for parse_events_error

Allowing symbolic events processing to report back error.

  $ perf record -e 'cycles/period=krava/' ls
  event syntax error: '../period=krava/'
                                 \___ expected numeric value

  $ perf record -e 'cycles/name=1/' ls
  event syntax error: '..es/name=1/'
                                 \___ expected string value

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429729824-13932-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c |  7 ++++---
 tools/perf/util/parse-events.h |  3 ++-
 tools/perf/util/parse-events.y | 11 ++++-------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 278aebe..80a50fd 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -625,7 +625,8 @@ static int config_attr(struct perf_event_attr *attr,
 	return 0;
 }
 
-int parse_events_add_numeric(struct list_head *list, int *idx,
+int parse_events_add_numeric(struct parse_events_evlist *data,
+			     struct list_head *list,
 			     u32 type, u64 config,
 			     struct list_head *head_config)
 {
@@ -636,10 +637,10 @@ int parse_events_add_numeric(struct list_head *list, int *idx,
 	attr.config = config;
 
 	if (head_config &&
-	    config_attr(&attr, head_config, NULL))
+	    config_attr(&attr, head_config, data->error))
 		return -EINVAL;
 
-	return add_event(list, idx, &attr, NULL);
+	return add_event(list, &data->idx, &attr, NULL);
 }
 
 static int parse_events__is_name_term(struct parse_events_term *term)
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 6286ffd..e236f1b 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -108,7 +108,8 @@ int parse_events__modifier_group(struct list_head *list, char *event_mod);
 int parse_events_name(struct list_head *list, char *name);
 int parse_events_add_tracepoint(struct list_head *list, int *idx,
 				char *sys, char *event);
-int parse_events_add_numeric(struct list_head *list, int *idx,
+int parse_events_add_numeric(struct parse_events_evlist *data,
+			     struct list_head *list,
 			     u32 type, u64 config,
 			     struct list_head *head_config);
 int parse_events_add_cache(struct list_head *list, int *idx,
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 38a0f21..3d11e00 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -274,8 +274,7 @@ value_sym '/' event_config '/'
 	int config = $1 & 255;
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_numeric(list, &data->idx,
-					  type, config, $3));
+	ABORT_ON(parse_events_add_numeric(data, list, type, config, $3));
 	parse_events__free_terms($3);
 	$$ = list;
 }
@@ -288,8 +287,7 @@ value_sym sep_slash_dc
 	int config = $1 & 255;
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_numeric(list, &data->idx,
-					  type, config, NULL));
+	ABORT_ON(parse_events_add_numeric(data, list, type, config, NULL));
 	$$ = list;
 }
 
@@ -405,7 +403,7 @@ PE_VALUE ':' PE_VALUE
 	struct list_head *list;
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL));
+	ABORT_ON(parse_events_add_numeric(data, list, (u32)$1, $3, NULL));
 	$$ = list;
 }
 
@@ -416,8 +414,7 @@ PE_RAW
 	struct list_head *list;
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_numeric(list, &data->idx,
-					  PERF_TYPE_RAW, $1, NULL));
+	ABORT_ON(parse_events_add_numeric(data, list, PERF_TYPE_RAW, $1, NULL));
 	$$ = list;
 }
 

  reply	other threads:[~2015-05-06  3:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 19:10 [PATCH 0/9] perf tools: Report event parsing errors Jiri Olsa
2015-04-22 19:10 ` [PATCH 1/9] perf tools: Add parse_events_error interface Jiri Olsa
2015-05-06  3:04   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 2/9] perf tools: Add flex support for parse_events_error Jiri Olsa
2015-05-06  3:04   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 3/9] perf tools: Always bail out when config_attr function fails Jiri Olsa
2015-05-06  3:04   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 4/9] perf tools: Change parse_events_add_pmu interface Jiri Olsa
2015-05-06  3:05   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 5/9] perf tools: Add location to pmu event terms Jiri Olsa
2015-05-06  3:05   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 6/9] perf tools: Add term support for parse_events_error Jiri Olsa
2015-05-06  3:05   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 7/9] perf tools: Add static terms " Jiri Olsa
2015-05-06  3:05   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 8/9] perf tools: Add tracepoint " Jiri Olsa
2015-05-06  3:06   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-22 19:10 ` [PATCH 9/9] perf tools: Add symbolic events " Jiri Olsa
2015-05-06  3:06   ` tip-bot for Jiri Olsa [this message]
2015-04-23 14:44 ` [PATCH 0/9] perf tools: Report event parsing errors Arnaldo Carvalho de Melo

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=tip-87d650be1dcc9bd9bb200e73b985ddb740d067bc@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).