perf stat: Add print_aggr_cgroup() for --for-each-cgroup and --topdown

Normally, --for-each-cgroup only works with AGGR_GLOBAL.  However
the --topdown on some cpu (e.g. Intel Skylake) converts it to the
AGGR_CORE internally.

To support those machines, add print_aggr_cgroup and handle the events
like in print_cgroup_events().

  $ perf stat -a --for-each-cgroup system.slice,user.slice --topdown sleep 1
  nmi_watchdog enabled with topdown. May give wrong results.
  Disable with echo 0 > /proc/sys/kernel/nmi_watchdog

   Performance counter stats for 'system wide':

                                                  retiring      bad speculation       frontend bound        backend bound
  S0-D0-C0              2  system.slice                   49.0%               -46.6%                31.4%
  S0-D0-C1              2  system.slice                   55.5%                 8.0%                45.5%                -9.0%
  S0-D0-C2              2  system.slice                   87.8%                22.1%                30.3%               -40.3%
  S0-D0-C3              2  system.slice                   53.3%               -11.9%                45.2%                13.4%
  S0-D0-C0              2  user.slice                    123.5%                 4.0%                48.5%               -75.9%
  S0-D0-C1              2  user.slice                     19.9%                 6.5%                89.9%               -16.3%
  S0-D0-C2              2  user.slice                     29.9%                 7.9%                71.3%                -9.1%
  S0-D0-C3              2  user.slice                     28.0%                 7.2%                43.3%                21.5%

         1.004136937 seconds time elapsed

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 file changed