mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: sukadev@linux.vnet.ibm.com
Cc: jolsa@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 5/5] perf, tools: Expand PMU events by prefetch match
Date: Fri,  5 Jun 2015 14:14:38 -0700	[thread overview]
Message-ID: <1433538878-13321-6-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1433538878-13321-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

When the user specifies a pmu directly, expand it automatically
with a prefix match, similar as we do for the normal aliases now.
This allows to specify attributes for duplicated boxes quickly.
For example uncore_cbox_{0,8}/.../ can be now specified as cbox/.../
and it gets automatically expanded.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/util/parse-events.y | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 2b90fb8..eb9aced 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -209,7 +209,23 @@ PE_NAME '/' event_config '/'
 	struct list_head *list;
 
 	ALLOC_LIST(list);
-	ABORT_ON(parse_events_add_pmu(data, list, $1, $3));
+	if (parse_events_add_pmu(data, list, $1, $3)) {
+		struct perf_pmu *pmu = NULL;
+		int ok = 0;
+
+		while ((pmu = perf_pmu__scan(pmu)) != NULL) {
+			char *name = pmu->name;
+
+			if (!strncmp(name, "uncore_", 7))
+				name += 7;
+			if (!strncmp($1, name, strlen($1))) {
+				if (!parse_events_add_pmu(data, list, pmu->name, $3))
+					ok++;
+			}
+		}
+		if (!ok)
+			YYABORT;
+	}
 	parse_events__free_terms($3);
 	$$ = list;
 }
-- 
2.4.2


      parent reply	other threads:[~2015-06-05 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 21:14 perf, tools: Add support for uncore events and updated Intel events Andi Kleen
2015-06-05 21:14 ` [PATCH 1/5] perf, tools: Add support for parsing uncore json files Andi Kleen
2015-06-05 21:14 ` [PATCH 2/5] perf, tools: Support per pmu json aliases Andi Kleen
2015-06-05 21:14 ` [PATCH 3/5] perf, tools: Support event aliases for non cpu// pmus Andi Kleen
2015-06-05 21:14 ` [PATCH 4/5] perf, tools: Add debug support for outputing alias string Andi Kleen
2015-06-05 21:14 ` Andi Kleen [this message]

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=1433538878-13321-6-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sukadev@linux.vnet.ibm.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

all inboxes | Powered by JetHome®