@@ -2064,18 +2064,29 @@ void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config,
20642064 name ?: "N/A" , buf , config_name , config );
20652065}
20662066
2067- int perf_pmu__match (const char * pattern , const char * name , const char * tok )
2067+ bool perf_pmu__match (const struct perf_pmu * pmu , const char * tok )
20682068{
2069- if (! name )
2070- return -1 ;
2069+ const char * name = pmu -> name ;
2070+ bool need_fnmatch = strchr ( tok , '*' ) != NULL ;
20712071
2072- if (fnmatch (pattern , name , 0 ))
2073- return -1 ;
2072+ if (!strncmp (tok , "uncore_" , 7 ))
2073+ tok += 7 ;
2074+ if (!strncmp (name , "uncore_" , 7 ))
2075+ name += 7 ;
20742076
2075- if (tok && !perf_pmu__match_ignoring_suffix (name , tok ))
2076- return -1 ;
2077+ if (perf_pmu__match_ignoring_suffix (name , tok ) ||
2078+ (need_fnmatch && !fnmatch (tok , name , 0 )))
2079+ return true;
20772080
2078- return 0 ;
2081+ name = pmu -> alias_name ;
2082+ if (!name )
2083+ return false;
2084+
2085+ if (!strncmp (name , "uncore_" , 7 ))
2086+ name += 7 ;
2087+
2088+ return perf_pmu__match_ignoring_suffix (name , tok ) ||
2089+ (need_fnmatch && !fnmatch (tok , name , 0 ));
20792090}
20802091
20812092double __weak perf_pmu__cpu_slots_per_cycle (void )
0 commit comments