Messages in this thread | | | From | Namhyung Kim <> | Date | Wed, 11 May 2022 22:01:15 -0700 | Subject | Re: [PATCH V3 13/23] perf evlist: Add evlist__add_dummy_on_all_cpus() |
| |
On Wed, May 11, 2022 at 9:33 PM Adrian Hunter <adrian.hunter@intel.com> wrote: > > On 12/05/22 01:50, Namhyung Kim wrote: > > On Wed, May 11, 2022 at 12:02 AM Adrian Hunter <adrian.hunter@intel.com> wrote: > >> > >> Add evlist__add_dummy_on_all_cpus() to enable creating a system-wide dummy > >> event that sets up the system-wide maps before map propagation. > >> > >> For convenience, add evlist__add_aux_dummy() so that the logic can be used > >> whether or not the event needs to be system-wide. > >> > >> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> > >> --- > >> > >> Changes in V3: Amended comment about all CPUs. > >> > >> tools/perf/util/evlist.c | 45 ++++++++++++++++++++++++++++++++++++++++ > >> tools/perf/util/evlist.h | 5 +++++ > >> 2 files changed, 50 insertions(+) > >> > >> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c > >> index 78c47cbafbc2..2b2900434bba 100644 > >> --- a/tools/perf/util/evlist.c > >> +++ b/tools/perf/util/evlist.c > >> @@ -264,6 +264,51 @@ int evlist__add_dummy(struct evlist *evlist) > >> return 0; > >> } > >> > >> +static void evlist__add_on_all_cpus(struct evlist *evlist, struct evsel *evsel) > >> +{ > >> + evsel->core.system_wide = true; > >> + > >> + /* > >> + * All CPUs. > >> + * > >> + * Note perf_event_open() does not accept CPUs that are not online, so > >> + * in fact this CPU list will include only all online CPUs. > >> + */ > >> + perf_cpu_map__put(evsel->core.own_cpus); > >> + evsel->core.own_cpus = perf_cpu_map__new(NULL); > >> + perf_cpu_map__put(evsel->core.cpus); > >> + evsel->core.cpus = perf_cpu_map__get(evsel->core.own_cpus); > > > > Maybe I'm missing something.. Wouldn't it be overwritten > > by the user requested cpus during map propagation in > > evlist__add()? > > Yes. That gets changed in patch 22 "perf tools: Allow system-wide > events to keep their own CPUs"
Oh, I see. I'll take a look.
Thanks, Namhyung
| |