Messages in this thread | | | Date | Wed, 29 Jan 2020 09:00:31 +0100 | From | Jiri Olsa <> | Subject | Re: [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
| |