[PATCH 5/5] perf, tools: Expand PMU events by prefetch match
From: Andi Kleen
Date: Fri Jun 05 2015 - 17:16:04 EST
From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/