In my blog about the most common pitfalls in analyzing application power consumption (http://redfort-software.intel.com/en-us/forums/showthread.php?t=106174&o=a&s=lr) I talked about potential issues that could drive power consumption to higher amounts. C-states are states when the CPU has reduced or turned off selected functions. Different processors support different numbers of C-states in which various parts of the CPU are turned off. To better understand the C-states that are supported and exposed, contact the CPU vendor. Generally, higher C-states turn off more parts of the CPU, which significantly reduces power consumption. Processors may have deeper C-states that are not exposed to the operating system. The goal of an application should be to operate in the deepest C-state possible while idle. It is also valuable to observe the frequency and length of the times the processor enters shallower and deeper C-states: generally less power will be consumed by an application if it minimizes the transitions (in and out) of C-states. In this and subsequent blogs I will dig deeper into what tools will be used to analyze your application’s behavior, and see if it is subject to any of the common pitfalls causing excessive power consumption. Here I will talk about how to use the Battery Life Analyzer (BLA).
What is BLA?
BLA is a software tool developed by Intel Corporation that runs on Microsoft* Windows and monitors software and hardware activities that affect battery life. BLA has many modules to support hardware and software analysis like CPU C-state, hard-drive, USB, PCI, memory, graphics activities, to name a few. For the scope of this blog, I look at two modules: CPU C-state and software activity analysis. For information about other modules, please look at the BLA user’s guide which is included in the downloaded BLA package. As of this writing, the latest version of BLA is 184.108.40.2061. send mailto:firstname.lastname@example.org to request a copy of BLA
After downloading the zip file from the above link, extract the content of the zip file to the desired folder. The contents of that folder will look something like this:
To run BLA, go to the folder containing BLA.exe. Right-click on the file and select the option, “Run as administrator”. Note that BLA is for mobile platforms running Windows only. Also, if the power cord is not unplugged, the package C7 value will be zero.
How BLA Determines Issues with C-state Residencies
The more time the system spends in the deep C-state, the less power it consumes. BLA recommends that the deepest C-state residency in Idle should be greater than 95% per package and 98% per core. Also, C0-C1 states per package should be less than 5% in Idle. The term package means physical or socket. A package has multiple cores. The C-state threshold value can be set via the option “CPU-State” under “Module Settings” which is under “Settings” in the main menu.
Best Way to Run BLA
According to the user’s guide, the best way to run BLA is to let the system remain idle for at least 15 minutes after starting BLA but before clicking the “Capture” button. Also, do not select the option to update the screen in BLA; by avoiding this, you minimize the impact of BLA on data collection.
Getting CPU C-state Residencies
In the following example we want to look at the impact on the CPU C-states by an application. Prior to starting the evaluation it is a good idea to close all unnecessary applications. Once you are ready to test make sure to start the application you want to analyze before hitting the “Capture” button to collect data. Let the application remain idle to ensure BLA captures data while the application is at rest. Select the module “CPU C-state” on the left hand side, click the button “Capture”, wait for two minutes and then click the button “stop”. For C-state analysis, capturing data for 1 – 2 minutes should be sufficient. BLA will display something like this:
If there are power consumption issues, BLA will highlight them. In this case, Core0 and Core1 C0-C1 state values are highlighted. To discover more about these issues, move the mouse to the highlighted area and right-click.
Click the sign “Show issue help” to read more about the warnings.
BLA shows that this warning has something to do with the CPU utilization and activity frequency issues. Go to those links to discover more.
Getting Software Activity Analysis
In this example, after seeing issues with C0-C1 state residencies, we run the software activity analysis module to figure out what caused those issues. Select the module “Software Activity Analysis” on the left hand side, click the button “Capture”, wait for two minutes and click the button “stop”. Note that the two-minute duration here is not mandatory. You can capture data as long as you need. BLA will display something like this:
Note the name of the application was blackened to protect its identity.
Again, right-click on the highlighted area to see what the issue is
Through this analysis, we find that this issue has something to do with the timer tick period. Microsoft recommends that the timer tick period should be set at 15.6ms in order to allow the system to stay longer in the deepest C-state. In this case, the timer tick period is 1ms, which is less than 15.6ms. This very short period will cause interrupts every 1ms, keeping the processor busy to prevent it from falling into a deeper C-state.
Taking a closer look at CPU C-state residencies allows you to see if your application is causing the system to not remain in a deep C-state while at rest. By using the Battery Life Analyzer, you can discover more detail about system power consumption and the potential reasons for it. In my next blog, I will look at two other tools, the Windows Performance Recorder (WPR) for collecting system data and the Windows Performance Analyzer (WPA) to further dig into what causes system power issues.