Bug 1203834 - Fix's rapl's handling of unsupported power domains. r=glandium.

The "gpu" and "ram" domains aren't supported by all platforms. rapl has a
special constant |kUnsupported_j| to represent this on Linux, but I
accidentally have a minus sign in front of it in several places, which means
that instead of printing "n/a" for unsupported planes we always print "1.0".

I think this happened because I used to hardwire -1 in there and then I later
changed it to a constant but forgot to remove the minus signs.

It sure would be nice to have automated testing for this stuff, but I don't see
how to do it.
This commit is contained in:
Nicholas Nethercote 2015-09-10 23:12:20 -07:00
parent 1cbe3c4479
commit b62c00faf8

View File

@ -390,12 +390,12 @@ public:
aCores_J = Joules(mPkes->pp0_energy - mPrevPp0Ticks, joulesPerTick);
aGpu_J = mIsGpuSupported
? Joules(mPkes->pp1_energy - mPrevPp1Ticks, joulesPerTick)
: -kUnsupported_j;
: kUnsupported_j;
aRam_J = mIsRamSupported
? Joules(mPkes->ddr_energy - mPrevDdrTicks,
mHasRamUnitsQuirk ? kQuirkyRamJoulesPerTick
: joulesPerTick)
: -kUnsupported_j;
: kUnsupported_j;
mPrevPkgTicks = mPkes->pkg_energy;
mPrevPp0Ticks = mPkes->pp0_energy;
@ -518,7 +518,7 @@ public:
double EnergyEstimate()
{
if (!mIsSupported) {
return -kUnsupported_j;
return kUnsupported_j;
}
uint64_t thisTicks;