|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
#define YYDEBUG 1
|
|
|
|
|
|
+#include <fnmatch.h>
|
|
|
#include <linux/compiler.h>
|
|
|
#include <linux/list.h>
|
|
|
#include <linux/types.h>
|
|
@@ -234,6 +235,10 @@ PE_NAME opt_event_config
|
|
|
if (parse_events_add_pmu(_parse_state, list, $1, $2)) {
|
|
|
struct perf_pmu *pmu = NULL;
|
|
|
int ok = 0;
|
|
|
+ char *pattern;
|
|
|
+
|
|
|
+ if (asprintf(&pattern, "%s*", $1) < 0)
|
|
|
+ YYABORT;
|
|
|
|
|
|
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
|
|
|
char *name = pmu->name;
|
|
@@ -241,14 +246,19 @@ PE_NAME opt_event_config
|
|
|
if (!strncmp(name, "uncore_", 7) &&
|
|
|
strncmp($1, "uncore_", 7))
|
|
|
name += 7;
|
|
|
- if (!strncmp($1, name, strlen($1))) {
|
|
|
- if (parse_events_copy_term_list(orig_terms, &terms))
|
|
|
+ if (!fnmatch(pattern, name, 0)) {
|
|
|
+ if (parse_events_copy_term_list(orig_terms, &terms)) {
|
|
|
+ free(pattern);
|
|
|
YYABORT;
|
|
|
+ }
|
|
|
if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms))
|
|
|
ok++;
|
|
|
parse_events_terms__delete(terms);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ free(pattern);
|
|
|
+
|
|
|
if (!ok)
|
|
|
YYABORT;
|
|
|
}
|