Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

Package Monitoring on a deep C State with RAPL

Carlos_P_
New Contributor I
989 Views

Hi,

I want to know if it's possible to monitor a package power consumption on a deep C state like 6 or 7. I believe it isn't, because Core, Rings and Uncore are powered down. I am using RAPL to trace the instant consumption and my setup is a Lenovo Laptop L440 (intel core i5 4200m).

I am asking that because I want to confirm the accuracy of the RAPL feature with the idle power estimation info table you present on your processor datasheet for the C6/C7 State. Is there any other data with not so deep C states to compare the RAPL with? External measures are not an option!

Waiting for some opinions.

Best regards,
Carlos Portela

0 Kudos
1 Solution
McCalpinJohn
Honored Contributor III
989 Views

Lots of the uncore is certainly powered down, but not all of it -- otherwise it would not know how to power back up!   So it is not obvious that the RAPL stuff does not increment during deep C-states

Since RAPL reports "energy" and not "power", you can make the overhead arbitrarily small by extending the measurement interval.  Just read the energy MSR, sleep() for a long time, then read it again.   The TSC is non-stop, so it will give you an accurate wall time, and testing successively longer intervals should let you see whether the RAPL infrastructure is accumulating non-zero energy during the sleep() periods.

View solution in original post

0 Kudos
10 Replies
McCalpinJohn
Honored Contributor III
990 Views

Lots of the uncore is certainly powered down, but not all of it -- otherwise it would not know how to power back up!   So it is not obvious that the RAPL stuff does not increment during deep C-states

Since RAPL reports "energy" and not "power", you can make the overhead arbitrarily small by extending the measurement interval.  Just read the energy MSR, sleep() for a long time, then read it again.   The TSC is non-stop, so it will give you an accurate wall time, and testing successively longer intervals should let you see whether the RAPL infrastructure is accumulating non-zero energy during the sleep() periods.

0 Kudos
Carlos_P_
New Contributor I
989 Views

John McCalpin wrote:

Lots of the uncore is certainly powered down, but not all of it -- otherwise it would not know how to power back up!   So it is not obvious that the RAPL stuff does not increment during deep C-states

Since RAPL reports "energy" and not "power", you can make the overhead arbitrarily small by extending the measurement interval.  Just read the energy MSR, sleep() for a long time, then read it again.   The TSC is non-stop, so it will give you an accurate wall time, and testing successively longer intervals should let you see whether the RAPL infrastructure is accumulating non-zero energy during the sleep() periods.



Thank you for your answer. Well, I believe that I didn't understand your suggestion that well. If I run the "sleep()" for a long time, the OS is always keeping the CPU up. I just run the C code below but, I didn't get the low consumption from C-State any close.

regards


 

result=read_msr(fd,MSR_PKG_ENERGY_STATUS);
package_before=(double)result*energy_units;
printf("Package energy before: %.6fJ\n",package_before);

sleep(60);

result=read_msr(fd,MSR_PKG_ENERGY_STATUS);
package_after=(double)result*energy_units;
printf("Package energy after: %.6f  (%.6fJ consumed)\n",
package_after,package_after-package_before);

 

0 Kudos
McCalpinJohn
Honored Contributor III
989 Views

There is no guarantee that your system is configured to use the package C6 or C7 states....

On the Xeon E5 processors there are counters in the uncore Power Control Unit to count occupancy in the Package C6 and Package C7 states, but I don't know if there are similar counters on the Core i3/i5/i7 processors.
 

0 Kudos
Carlos_P_
New Contributor I
989 Views


I think the C7 state is being used. I left the system on idle during 2 hours and after it, I run the PowerTop tool and I found this(attached photo) info about the CPU.
So.. maybe a longer sleep would present me some better results?


EDIT: well, just did 30 mins sleep... and still 5W package consumption... so I believe it's not working... Package should be using C7 state too, on the powertop, right?



 

 

0 Kudos
McCalpinJohn
Honored Contributor III
989 Views

I am not sure what answer you are expecting or what you are doing to calculate the answer you are getting....

Have you tried reading the RAPL energy register, leaving the computer completely alone for 30 minutes, and then reading it again?

0 Kudos
Carlos_P_
New Contributor I
989 Views

Sorry for the unclear explanation. Yes, I tried to read the MSR between 30 minutes "leaving computer alone". The average power consumption during that time was 5,3 Watts and, by the data sheet info that you can check on this post attachment, the CPU consumption should be near 2,5W. 
 

0 Kudos
McCalpinJohn
Honored Contributor III
990 Views

The PowerTop screenshot shows 98.9% of the time in "Package C2", with 0% in "Package C3", "Package C6", or "Package C7" states.

0 Kudos
Carlos_P_
New Contributor I
989 Views

I noticed that but I see that cores are reaching the C7 state. Doesn't that matter?
Is there anyway to configure package to use the C7 state?

Thank your for your help!

0 Kudos
McCalpinJohn
Honored Contributor III
989 Views

Support for deep package C-states is likely to be determined by a combination of processor capability, system design decisions, system configuration decisions, BIOS settings, and OS settings.   For example, in Section 4.2 of Volume 1 of the 4th generation Core family mobile processor datasheet (document 328901), there is an extended discussion of the rules for entering various package C states, which includes non-obvious settings such as the number of graphics displays, their resolution, and their self-refresh mode setting (e.g., Table 20).

I would look first for BIOS options relating to power savings and display configuration, then I would look into the OS power saving settings.  If nothing is obvious, then the feature may not be supported by the platform (even though it is clearly supported by the processor).

0 Kudos
Carlos_P_
New Contributor I
989 Views

I'll give a look on it! Thanks for the help.

0 Kudos
Reply