Re: Add top down metrics to perf stat

From: Andi Kleen
Date: Thu May 19 2016 - 19:51:37 EST


On Mon, May 16, 2016 at 02:58:38PM +0200, Jiri Olsa wrote:
> On Fri, May 13, 2016 at 06:44:49PM -0700, Andi Kleen wrote:
>
> SNIP
>
> >
> > The formulas to compute the metrics are generic, they
> > only change based on the availability on the abstracted
> > input values.
> >
> > The kernel declares the events supported by the current
> > CPU and perf stat then computes the formulas based on the
> > available metrics.
> >
> >
> > Example output:
> >
> > $ perf stat --topdown -I 1000 cmd
> > 1.000735655 frontend bound retiring bad speculation backend bound
> > 1.000735655 S0-C0 2 47.84% 11.69% 8.37% 32.10%
> > 1.000735655 S0-C1 2 45.53% 11.39% 8.52% 34.56%

Hi Jiri,
>
> you've lost first 3 header lines (time/core/cpus):
>
> [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --per-core -e cycles -I 1000 -a
> # time core cpus counts unit events
> 1.000310344 S0-C0 2 3,764,470,414 cycles
> 1.000310344 S0-C1 2 3,764,445,293 cycles
> 1.000310344 S0-C2 2 3,764,428,422 cycles

I can't reproduce that.

The headers look the same as before.

>
> also I'm still getting -0% as I mentioned in my previous comment:

Keeping the NMI watchdog enabled can make the formulas inaccurate
because the grouping is disabled, and parts of the formulas
may be measured at different times where the execution profile
is different.

But anyways even without that it can be caused by small inaccuracies,
and then during rounding the value rounds to 0.
I can remove the - for this case.

Otherwise the data looks reasonable.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.