Re: [PATCH v1 4/5] perf, tools: Add fallback in perf_evsel__nr_cpus for no map

From: Andi Kleen
Date: Tue Nov 14 2017 - 00:03:57 EST


On Mon, Nov 13, 2017 at 10:22:30AM +0100, Jiri Olsa wrote:
> On Thu, Nov 09, 2017 at 06:55:27AM -0800, Andi Kleen wrote:
> > From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> >
> > Support the case of the event having no cpumap in perf_evsel__nr_cpus.
> > Just return 1 in this case. This can happen in perf script
> > when it uses the perf stat shadow functions.
>
> why 1, where in shadow code? you can synthesize cpus for event
> via event_update event

For sampling it should be always 1, right?

Where:

#0 0x0000000000570e03 in __perf_evsel_stat__is (evsel=0x2690ce0,
id=PERF_STAT_EVSEL_ID__CYCLES_IN_TX) at util/stat.c:75
#1 0x0000000000572375 in perf_stat__update_shadow_stats
(counter=0x2690ce0, count=3744, cpu=0) at util/stat-shadow.c:194

-Andi