[lkml]   [2016]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power reporting mechanism
Hi Vince,

Thanks for asking.

On Wed, Jun 15, 2016 at 09:13:59PM -0400, Vince Weaver wrote:
> three questions about this functionality:
> 1. In theory this should also work on an amd fam16h model 30h
> processor too, correct? The current code limits things to fam15h
> even though the fam16mod30h has all the proper cpuid flags.

I was told this feature would be supported on fam15h 60h, 70h and
later processors before. Just checked the fam16h model 30h BKDG, yes,
it should be also supported. But I didn't test that platform, if you
confirm it works in your side. We can enable it.

> I've tested the functionality a bit and it seems to work but for
> some reason the ptsc seems to occasionally count backwards
> on my machine. Any reason that would be? (It doesn't seem to be
> an overflow, just reading the ptsc 5ms apart and the values are
> slightly lower after than before).

PTSC's frequency is about 100Mhz, it shouldn't be overflow.

> 2. Unless I'm misunderstanding things, the code seems to be accumulating
> Power. (see chunk below) Power is an instantaneous measurement, it
> makes no sense to add values. If you use 5W for 1ms and 10W for
> 1ms, the average power across the 2ms interval is not 15W.
> You can add energy, but not power.
> > + delta *= cpu_pwr_sample_ratio * 1000;
> > + tdelta = new_ptsc - prev_ptsc;
> > +
> > + do_div(delta, tdelta);
> > + local64_add(delta, &event->count);

You're right. Nice catch! The average power is per compute unit. We
cannot add the power simplely for each processor/package.

So here, the average power per package should be (delta1 + delta2 + ... + deltaN)/(tdelta_avg).
I will work out a fix. Thanks to point out.

> 3. The actual results gathered seem rediculously low. 341 seconds of
> calculation and only using 183 mWatts of power?

mWatts are for processor power not system power. Below data is
calculated on fam15h model 60h which is low power platform. Even
though the method has a minor mistake, the processor power should be
in mWatts field.

> > Performance counter stats for 'system wide':
> >
> > 183.44 mWatts power/power-pkg/
> >
> > 341.837270111 seconds time elapsed
> >
> > root@hr-zp:/home/ray/tip# ./tools/perf/perf stat -a -e 'power/power-pkg/' sleep 10


 \ /
  Last update: 2016-06-16 09:01    [W:0.151 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site