Messages in this thread Patch in this message | | | From | Andi Kleen <> | Subject | [PATCH 5/5] perf, tools: Expand PMU events by prefetch match | Date | Fri, 5 Jun 2015 14:14:38 -0700 |
| |
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
| |