Re: [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power reporting mechanism
From: Vince Weaver
Date: Thu Jun 16 2016 - 17:11:03 EST
On Thu, 16 Jun 2016, Huang Rui wrote:
> On Thu, Jun 16, 2016 at 01:38:13PM +0800, Huang Rui wrote:
>
> After considering carefully, the original method should be OK.
>
> AMD nomenclature for CMT systems:
>
> [node 0] -> [Compute Unit 0] -> [Compute Unit Core 0] -> Linux CPU 0
> -> [Compute Unit Core 1] -> Linux CPU 1
> -> [Compute Unit 1] -> [Compute Unit Core 0] -> Linux CPU 2
> -> [Compute Unit Core 1] -> Linux CPU 3
>
> The deltaN is power per compute unit. Current one package has two CUs.
> In the *same* interval, CU0's power is 10W, CU1's power is 15W. The
> package (CU0 + CU1) power should be 15W, right? Because the interval
> is the same.
>
> Q = Q1 + Q2. P = Q/t = (Q1 + Q2)/t = Q1/t + Q2/t = P1 + P2.
>
> Is that clear?
OK, I was misunderstanding. I somehow thought there was a periodic timer
that was adding accumulating power over time.
But no, the driver just assumes the PTSC does not overflow? And that
addition is just there to handle adding all the cores together?
If so, then I agree that the addition makes sense, sorry for confusing
things.
Although I think it would be better if we reported Joules (like
RAPL does) rather than average power, but too late to change that now.
Also, on my machine I get results that make no physical sense, such as:
sudo perf stat -a -e power/power-pkg/ /usr/games/primes 1 500000000 > /dev/null
Performance counter stats for 'system wide':
4,472,401.06 mWatts power/power-pkg/
6.956135769 seconds time elapsed
I somehow don't think the CPU is really burning 4kW of Power.
Vince