perf, tools: Use group read in perf stat

After the kernel fix
ba5213ae6b88 ("perf/core: Correct event creation with PERF_FORMAT_GROUP")
it is possible to use a group read to read inherited perf stat events.

This can drastically lower overhead for large event collections
because perf stat needs much less system calls, and perf also
needs much less IPIs because each group read only needs a single interrupt
instead of one perf event.

This patch tries to use a group read for reading grouped counters,
and if it doesn't work falls back to reading individually.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
3 files changed