Re: [PATCH v3 3/7] perf evsel: Add iterator to iterate over events ordered by CPU

Jiri Olsa
2019-11-01T08:38:37Z

On Wed, Oct 30, 2019 at 12:03:28PM -0700, Andi Kleen wrote:
> >
> > > The exists evlist->cpus cannot be used (I tried that)
> > > I also don't think we have an existing function to merge
> > > two maps, so that would need to be added to create it.
> > > Just using ->cpu_index is a much simpler change.
> >
> > I dont think that would be lot of code
> > and it would simplify this one
>
> AFAIK they're not guaranteed to be sorted, which makes merging
> complicated. I'm not sure it's safe to just sort existing maps
> because someone might have a index.

we could add bitmap to maps, then combining them
would be just a matter of or-ing them

>
> So you'll need to create temporary maps, sort them and then
> merge. Won't be simple.

it's also not simple to read simple event close code now

jirka