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

From: Andi Kleen
Date: Wed Oct 30 2019 - 15:03:33 EST


>
> > 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.

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

-Andi