@@ -597,17 +597,14 @@ static int __metricgroup__add_metric(struct list_head *group_list,
597
597
598
598
static int metricgroup__add_metric (const char * metric , bool metric_no_group ,
599
599
struct strbuf * events ,
600
- struct list_head * group_list )
600
+ struct list_head * group_list ,
601
+ struct pmu_events_map * map )
601
602
{
602
- struct pmu_events_map * map = perf_pmu__find_map (NULL );
603
603
struct pmu_event * pe ;
604
604
struct egroup * eg ;
605
605
int i , ret ;
606
606
bool has_match = false;
607
607
608
- if (!map )
609
- return 0 ;
610
-
611
608
for (i = 0 ; ; i ++ ) {
612
609
pe = & map -> table [i ];
613
610
@@ -668,7 +665,8 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
668
665
669
666
static int metricgroup__add_metric_list (const char * list , bool metric_no_group ,
670
667
struct strbuf * events ,
671
- struct list_head * group_list )
668
+ struct list_head * group_list ,
669
+ struct pmu_events_map * map )
672
670
{
673
671
char * llist , * nlist , * p ;
674
672
int ret = - EINVAL ;
@@ -683,7 +681,7 @@ static int metricgroup__add_metric_list(const char *list, bool metric_no_group,
683
681
684
682
while ((p = strsep (& llist , "," )) != NULL ) {
685
683
ret = metricgroup__add_metric (p , metric_no_group , events ,
686
- group_list );
684
+ group_list , map );
687
685
if (ret == - EINVAL ) {
688
686
fprintf (stderr , "Cannot find metric or group `%s'\n" ,
689
687
p );
@@ -713,7 +711,8 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
713
711
bool metric_no_group ,
714
712
bool metric_no_merge ,
715
713
struct perf_pmu * fake_pmu ,
716
- struct rblist * metric_events )
714
+ struct rblist * metric_events ,
715
+ struct pmu_events_map * map )
717
716
{
718
717
struct parse_events_error parse_error ;
719
718
struct strbuf extra_events ;
@@ -723,7 +722,7 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
723
722
if (metric_events -> nr_entries == 0 )
724
723
metricgroup__rblist_init (metric_events );
725
724
ret = metricgroup__add_metric_list (str , metric_no_group ,
726
- & extra_events , & group_list );
725
+ & extra_events , & group_list , map );
727
726
if (ret )
728
727
return ret ;
729
728
pr_debug ("adding %s\n" , extra_events .buf );
@@ -748,9 +747,13 @@ int metricgroup__parse_groups(const struct option *opt,
748
747
struct rblist * metric_events )
749
748
{
750
749
struct evlist * perf_evlist = * (struct evlist * * )opt -> value ;
750
+ struct pmu_events_map * map = perf_pmu__find_map (NULL );
751
+
752
+ if (!map )
753
+ return 0 ;
751
754
752
755
return parse_groups (perf_evlist , str , metric_no_group ,
753
- metric_no_merge , NULL , metric_events );
756
+ metric_no_merge , NULL , metric_events , map );
754
757
}
755
758
756
759
bool metricgroup__has_metric (const char * metric )
0 commit comments