On Wed, May 20, 2020 at 12:28:12AM -0700, Ian Rogers wrote:

SNIP

>  
> @@ -157,7 +183,7 @@ static int metricgroup__setup_events(struct list_head 
> *groups,
>       int i = 0;
>       int ret = 0;
>       struct egroup *eg;
> -     struct evsel *evsel;
> +     struct evsel *evsel, *tmp;
>       unsigned long *evlist_used;
>  
>       evlist_used = bitmap_alloc(perf_evlist->core.nr_entries);
> @@ -173,7 +199,8 @@ static int metricgroup__setup_events(struct list_head 
> *groups,
>                       ret = -ENOMEM;
>                       break;
>               }
> -             evsel = find_evsel_group(perf_evlist, &eg->pctx, metric_events,
> +             evsel = find_evsel_group(perf_evlist, &eg->pctx,
> +                                     eg->has_constraint, metric_events,
>                                       evlist_used);
>               if (!evsel) {
>                       pr_debug("Cannot resolve %s: %s\n",
> @@ -200,6 +227,12 @@ static int metricgroup__setup_events(struct list_head 
> *groups,
>               list_add(&expr->nd, &me->head);
>       }
>  
> +     evlist__for_each_entry_safe(perf_evlist, tmp, evsel) {
> +             if (!test_bit(evsel->idx, evlist_used)) {
> +                     evlist__remove(perf_evlist, evsel);
> +                     evsel__delete(evsel);
> +             }

is the groupping still enabled when we merge groups? could part
of the metric (events) be now computed in different groups?

I was wondering if we could merge all the hasmaps into single
one before the parse the evlist.. this way we won't need removing
later.. but I did not thought this through completely, so it
might not work at some point

jirka

Reply via email to