simpleperf: stat: don't open event files across cpus.

When monitoring an hardware event for a thread running on all cpus,
the stat cmd opens one event file to monitor the thread across all
cpus. This works because CPU PMUs on all cpus are managed by one
pmu object in perf event driver in the kernel. And the event file is
bounded to a pmu object. So it can transfer with the thread between
cpus.

But now big/little ARM cores may have different numbers of CPU PMU
hardware counters. To fully use them, CPU PMUs on big/little cores
need to be managed by different pmu objects. As a result, event files
can't be transfered between cpus belonging to different pmu objects.

To work with this, this patch changes the stat cmd to open one event
file for each cpu. But after that, we can't tell if hardware counter
multiplexing happens by checking if runtime equals enabled time. So
we avoid showing the runtime / enabled_time percentage. Instead,
we check if events used are more than hardware counters available on
each cpu.

Bug: 243065368
Test: simpleperf_unit_test
Change-Id: I0eb6acbdb2c23bd726be90232a8d97285dac5482
(cherry picked from commit 4ed8e11cc2adf37eb95b922f51a029617c875874)
2 files changed