lkml.org 
[lkml]   [2020]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] tools/perf/metricgroup: Fix printing event names of metric group with multiple events incase of overlapping events
On Wed, Jan 29, 2020 at 12:10:22PM +0530, kajoljain wrote:

SNIP

> > - i = 0;
> > - memset(metric_events, 0,
> > - sizeof(struct evsel *) * idnum);
> > - continue;
> > }
>
> Incase we have match miss, we need to restart the match comparison again.
>
> But I think we can't totally remove this check as, we also need to make sure
> we take current event in match logic. Maybe something like this:
>
>                 } else {
>
> -                       if (i + 1 == idnum) {
> -                               /* Discard the whole match and start again
> */
> -                               i = 0;
> -                               memset(metric_events, 0,
> -                                      sizeof(struct evsel *) * idnum);
> -                               continue;
> -                       }
> -
> -                       if (!strcmp(ev->name, ids[i]))
> -                               metric_events[i] = ev;
> -                       else {
> -                               /* Discard the whole match and start again
> */
> -                               i = 0;
> -                               memset(metric_events, 0,
> -                                      sizeof(struct evsel *) * idnum);
> -                               continue;
>
> +                       /* Discard the whole match and start again */
> +                       i = 0;
> +                       memset(metric_events, 0,
> +                               sizeof(struct evsel *) * idnum);
> +
> +                       if (!strcmp(ev->name, ids[i])) {
> +                               if (!metric_events[i])
> +                                       metric_events[i] = ev;
> +                               i++;
> +                               if (i == idnum)
> +                                       break;
>                         }
>
> Please let me know if it sounds fine.

ah right.. we need to compare the event with the first id, sounds good

thanks,
jirka

\
 
 \ /
  Last update: 2020-01-29 09:01    [W:0.107 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site