Re: Add top down metrics to perf stat

From: Jiri Olsa
Date: Thu May 12 2016 - 03:47:12 EST


On Thu, May 05, 2016 at 04:03:57PM -0700, Andi Kleen wrote:

SNIP

> 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%
> 2.003978563 S0-C0 2 49.47% 12.22% 8.65% 29.66%
> 2.003978563 S0-C1 2 47.21% 12.98% 8.77% 31.04%
> 3.004901432 S0-C0 2 49.35% 12.26% 8.68% 29.70%
> 3.004901432 S0-C1 2 47.23% 12.67% 8.76% 31.35%
> 4.005766611 S0-C0 2 48.44% 12.14% 8.59% 30.82%
> 4.005766611 S0-C1 2 46.07% 12.41% 8.67% 32.85%
> 5.006580592 S0-C0 2 47.91% 12.08% 8.57% 31.44%
> 5.006580592 S0-C1 2 45.57% 12.27% 8.63% 33.53%
> 6.007545125 S0-C0 2 47.45% 12.02% 8.57% 31.96%
> 6.007545125 S0-C1 2 45.13% 12.17% 8.57% 34.14%
> 7.008539347 S0-C0 2 47.07% 12.03% 8.61% 32.29%


getting -0% for bad speculation.. im on your perf/top-down-20

thanks,
jirka


[root@ibm-x3650m4-01 perf]# ./perf stat --topdown -a -I 1000
nmi_watchdog enabled with topdown. May give wrong results.
Disable with echo 0 > /proc/sys/kernel/nmi_watchdog
1.002322346 retiring bad speculation frontend bound backend bound
1.002322346 S0-C0 2 38.3% 0.0% 57.9% 3.8%
1.002322346 S0-C1 2 38.3% 0.0% 59.1% 2.6%
1.002322346 S0-C2 2 38.3% 0.0% 59.0% 2.6%
1.002322346 S0-C3 2 38.3% 0.0% 58.7% 3.0%
1.002322346 S0-C4 2 38.3% -0.0% 58.6% 3.1%
1.002322346 S0-C5 2 38.4% -0.0% 58.3% 3.3%
1.002322346 S1-C0 2 38.3% -0.0% 58.7% 3.0%
1.002322346 S1-C1 2 38.3% 0.0% 59.7% 2.0%
1.002322346 S1-C2 2 38.3% -0.0% 59.3% 2.5%
1.002322346 S1-C3 2 38.3% -0.0% 59.1% 2.5%
1.002322346 S1-C4 2 38.3% 0.0% 59.1% 2.6%
1.002322346 S1-C5 2 38.3% -0.0% 59.1% 2.7%
2.005429451 S0-C0 2 38.3% 0.0% 57.9% 3.8%
...