All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, alexander.shishkin@linux.intel.com,
	namhyung@kernel.org, jolsa@kernel.org, mingo@kernel.org,
	acme@redhat.com, hpa@zytor.com
Subject: [tip:perf/core] perf tools: Fix legacy events symbol separator parsing
Date: Fri, 15 Feb 2019 01:49:47 -0800	[thread overview]
Message-ID: <tip-714a92d83fd1e20461f53549cfbee77b20be5032@git.kernel.org> (raw)
In-Reply-To: <20190213123246.4015-5-jolsa@kernel.org>

Commit-ID:  714a92d83fd1e20461f53549cfbee77b20be5032
Gitweb:     https://git.kernel.org/tip/714a92d83fd1e20461f53549cfbee77b20be5032
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 13 Feb 2019 13:32:40 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 14 Feb 2019 15:18:08 -0300

perf tools: Fix legacy events symbol separator parsing

Fixing legacy symbol events parsing. We can't support single slash
separator, like 'cycles/u', because it conflicts with non empty terms,
like 'cycles/period/u'.

Keeping only '//' and ':' separator for these events:
  cycles//u
  cycles:k

And removing '/' separator support, which is not working
anymore. Also adding automated tests for above events.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190213123246.4015-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/parse-events.c | 30 ++++++++++++++++++++++++++++++
 tools/perf/util/parse-events.y  |  4 ++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3b97ac018d5a..4a69c07f4101 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1330,6 +1330,26 @@ static int test__checkevent_complex_name(struct perf_evlist *evlist)
 	return 0;
 }
 
+static int test__sym_event_slash(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE);
+	TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES);
+	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
+	return 0;
+}
+
+static int test__sym_event_dc(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE);
+	TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES);
+	TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
+	return 0;
+}
+
 static int count_tracepoints(void)
 {
 	struct dirent *events_ent;
@@ -1670,6 +1690,16 @@ static struct evlist_test test__events[] = {
 		.name  = "cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk",
 		.check = test__checkevent_complex_name,
 		.id    = 53
+	},
+	{
+		.name  = "cycles//u",
+		.check = test__sym_event_slash,
+		.id    = 54,
+	},
+	{
+		.name  = "cycles:k",
+		.check = test__sym_event_dc,
+		.id    = 55,
 	}
 };
 
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index da8fe57691b8..44819bdb037d 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -311,7 +311,7 @@ value_sym '/' event_config '/'
 	$$ = list;
 }
 |
-value_sym sep_slash_dc
+value_sym sep_slash_slash_dc
 {
 	struct list_head *list;
 	int type = $1 >> 16;
@@ -702,7 +702,7 @@ PE_VALUE PE_ARRAY_RANGE PE_VALUE
 
 sep_dc: ':' |
 
-sep_slash_dc: '/' | ':' |
+sep_slash_slash_dc: '/' '/' | ':' |
 
 %%
 

  reply	other threads:[~2019-02-15  9:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 12:32 [PATCH 00/10] perf tools: Assorted fixes Jiri Olsa
2019-02-13 12:32 ` [PATCH 01/10] perf tools: Compile perf with libperf-in.o instead of libperf.a Jiri Olsa
2019-02-15  9:47   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 02/10] perf tools: Rename LIB_FILE to LIBPERF_A Jiri Olsa
2019-02-15  9:48   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 03/10] perf tools: Rename build libperf to perf Jiri Olsa
2019-02-15  9:49   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 04/10] perf tools: Fix legacy events symbol separator parsing Jiri Olsa
2019-02-15  9:49   ` tip-bot for Jiri Olsa [this message]
2019-02-13 12:32 ` [PATCH 05/10] perf list: Display metric expressions for --details option Jiri Olsa
2019-02-15  9:50   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 06/10] perf header: Fix wrong node write in NUMA_TOPOLOGY feature Jiri Olsa
     [not found]   ` <20190213210943.GF1904@kernel.org>
     [not found]     ` <20190213211428.GG1904@kernel.org>
2019-02-15 18:12       ` Jiri Olsa
2019-02-13 12:32 ` [PATCH 07/10] perf header: Get rid of write_it label Jiri Olsa
2019-02-15  9:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 08/10] perf header: Remove cpu_nr from struct cpu_topo Jiri Olsa
2019-02-15  9:51   ` [tip:perf/core] perf header: Remove unused 'cpu_nr' field from 'struct cpu_topo' tip-bot for Jiri Olsa
2019-02-13 12:32 ` [PATCH 09/10] perf tools: Add perf_topo_cpu object Jiri Olsa
     [not found]   ` <20190213211935.GH1904@kernel.org>
2019-02-15 18:12     ` Jiri Olsa
2019-02-13 12:32 ` [PATCH 10/10] perf tools: Add perf_topo_numa object Jiri Olsa

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-714a92d83fd1e20461f53549cfbee77b20be5032@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.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=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.