[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191030155108.taqo2kbuaro3idhe@two.firstfloor.org>
Date: Wed, 30 Oct 2019 08:51:08 -0700
From: Andi Kleen <andi@...stfloor.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Andi Kleen <andi@...stfloor.org>, acme@...nel.org,
jolsa@...nel.org, eranian@...gle.com, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v3 3/7] perf evsel: Add iterator to iterate over events
ordered by CPU
On Wed, Oct 30, 2019 at 11:06:06AM +0100, Jiri Olsa wrote:
> > +struct perf_cpu_map *evlist__cpu_iter_start(struct evlist *evlist)
> > +{
> > + struct perf_cpu_map *cpus;
> > + struct evsel *pos;
> > +
> > + /*
> > + * evlist->cpus is not necessarily a superset of all the
> > + * event's cpus, so compute our own super set. This
> > + * assume that there is a super set
> > + */
> > + cpus = evlist->core.cpus;
> > + evlist__for_each_entry(evlist, pos) {
> > + pos->cpu_index = 0;
> > + if (pos->core.cpus->nr > cpus->nr)
> > + cpus = pos->core.cpus;
> > + }
> > + return cpus;
>
> I might not understand the reason for cpu_index, but
This is just so that we can iterate each event's map
independently.
> imagine something like below should be enough, no?
Well it's more complicated because evlist->all_cpus doesn't exist.
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.
-Andi
Powered by blists - more mailing lists