linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Brendan Gregg <brendan.d.gregg@gmail.com>,
	Cody P Schafer <dev@codyps.com>, He Kuang <hekuang@huawei.com>,
	Jeremie Galarneau <jeremie.galarneau@efficios.com>,
	Jiri Olsa <jolsa@kernel.org>, Kirill Smelkov <kirr@nexedi.com>,
	Li Zefan <lizefan@huawei.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	pi3orama@163.com
Subject: [PATCH 12/22] perf tools: Introduce opt_event_config nonterminal
Date: Fri, 19 Feb 2016 19:41:26 -0300	[thread overview]
Message-ID: <1455921696-3895-13-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1455921696-3895-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

To remove duplicated code that differs only in using the matching
'/a,b,c/' part or NULL if no event configuration is done ('//' or no
pair of slashes at all).

Will be used by some new targets allowing the configuration of hardware
events, etc.

Lifted part of the 'opt_event_config' nonterminal from a patch by Wang
Nan.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/n/tip-e3xzpx9cqsmwnaguaxyw6r42@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.y | 47 ++++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 29 deletions(-)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index c0eac88ef474..ce68746bdc89 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -64,6 +64,7 @@ static inc_group_count(struct list_head *list,
 %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT
 %type <num> value_sym
 %type <head> event_config
+%type <head> opt_event_config
 %type <term> event_term
 %type <head> event_pmu
 %type <head> event_legacy_symbol
@@ -222,16 +223,6 @@ PE_NAME '/' event_config '/'
 	$$ = list;
 }
 |
-PE_NAME '/' '/'
-{
-	struct parse_events_evlist *data = _data;
-	struct list_head *list;
-
-	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_pmu(data, list, $1, NULL));
-	$$ = list;
-}
-|
 PE_KERNEL_PMU_EVENT sep_dc
 {
 	struct parse_events_evlist *data = _data;
@@ -378,7 +369,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc
 }
 
 event_legacy_tracepoint:
-tracepoint_name
+tracepoint_name opt_event_config
 {
 	struct parse_events_evlist *data = _data;
 	struct parse_events_error *error = data->error;
@@ -389,24 +380,7 @@ tracepoint_name
 		error->idx = @1.first_column;
 
 	if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
-					error, NULL))
-		return -1;
-
-	$$ = list;
-}
-|
-tracepoint_name '/' event_config '/'
-{
-	struct parse_events_evlist *data = _data;
-	struct parse_events_error *error = data->error;
-	struct list_head *list;
-
-	ALLOC_LIST(list);
-	if (error)
-		error->idx = @1.first_column;
-
-	if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
-					error, $3))
+					error, $2))
 		return -1;
 
 	$$ = list;
@@ -476,6 +450,21 @@ PE_BPF_SOURCE
 	$$ = list;
 }
 
+opt_event_config:
+'/' event_config '/'
+{
+	$$ = $2;
+}
+|
+'/' '/'
+{
+	$$ = NULL;
+}
+|
+{
+	$$ = NULL;
+}
+
 start_terms: event_config
 {
 	struct parse_events_terms *data = _data;
-- 
2.5.0

  parent reply	other threads:[~2016-02-19 22:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 22:41 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 01/22] perf evlist: Reference count the cpu and thread maps at set_maps() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 02/22] perf record: Add --all-user/--all-kernel options Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 03/22] perf evlist: Handle -EINVAL for sample_freq > max_sample_rate in strerror_open() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 04/22] perf tests: Use perf_evlist__strerror_open() to provide hints about max_freq Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 05/22] perf test: Reduce the sample_freq for the 'object code reading' test Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 06/22] perf stat: Handled scaled == -1 case for counters Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 07/22] perf bpf: Rename bpf_prog_priv__clear() to clear_prog_priv() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 08/22] perf tools: Fix checking asprintf return value Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 09/22] perf tools: Create config_term_names array Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 10/22] perf stat: Bail out on unsupported event config modifiers Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 11/22] perf tools: Rename and move pmu_event_name to get_config_name Arnaldo Carvalho de Melo
2016-02-19 22:41 ` Arnaldo Carvalho de Melo [this message]
2016-02-19 22:41 ` [PATCH 13/22] perf tools: Enable config raw and numeric events Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 14/22] perf tools: Enable config and setting names for legacy cache events Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 15/22] perf hists browser: Fix percentage update on key press Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 16/22] perf callchain: Check return value of add_child() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 17/22] perf callchain: Check return value of fill_node() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 18/22] perf callchain: Add enum match_result for match_chain() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 19/22] perf callchain: Check return value of split_add_child() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 20/22] perf callchain: Check return value of append_chain_children() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 21/22] perf hists: Return error from hists__collapse_resort() Arnaldo Carvalho de Melo
2016-02-19 22:41 ` [PATCH 22/22] perf report: Check error during report__collapse_hists() Arnaldo Carvalho de Melo
2016-02-20 10:56 ` [GIT PULL 00/22] perf/core improvements and fixes Ingo Molnar

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=1455921696-3895-13-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ast@kernel.org \
    --cc=brendan.d.gregg@gmail.com \
    --cc=dev@codyps.com \
    --cc=hekuang@huawei.com \
    --cc=jeremie.galarneau@efficios.com \
    --cc=jolsa@kernel.org \
    --cc=kirr@nexedi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pi3orama@163.com \
    /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).