Using Windows Performance Toolkit in Analyzing Application Power Consumption

In my previous blogs I discussed the most common pitfalls in application power consumption and how to use the Battery Life Analyzer (BLA) software to find power issues.  In this blog I will explain how to use the Microsoft* Windows Performance Toolkit (WPT) to determine what causes power issues.

What is WPT?

WPT includes two tools: the Windows Performance Recorder (WPR) which collects data, and the Windows Performance Analyzer (WPA) which analyzes data.

WPR is a performance recording tool based on Event Tracing for Windows (ETW). It captures detailed system and application behavior, and resource usage.

WPA reviews performance aspects on Windows. WPA opens event trace log files and displays the performance data in graphs and tables, making it easy to investigate potential issues.  With WPR and WPA, you can often determine what processes consume power when you don’t expect it.  Then you can drill down to the process, thread, and API level to find the power hungry calls in the application.

WPT is included in the Microsoft* Windows Software Development Kit (SDK).  The SDK can be downloaded here.

The SDK is tested with the current build of Windows 8 which is RTM.

Installing WPT

After downloading the SDK, run it and follow screen instructions.  You only need to select the option to install WPT.

Running WPR

From the desktop UI, open a command prompt window and type:


You can also click the tile “Windows Performance Recorder” from the New Microsoft Windows* 8 UI to run WPR as shown below:

Select “More options” to specify what to collect:

Next, choose “Resource Analysis”

Check the options “CPU usage” and “Power usage”


Click the “Start” button to begin collecting data.

Once the data collection process is done, select “Save” to save data to the file.

Next, click “Browse” to specify the trace file name with the extension “etl”.  You can choose where to save it, or just use the default file and location names.  Note that you need to enter the description where the green circle is.  Otherwise, the “Save” button will be disabled.  Click “Save” when done.

Click “OK” to complete this step.

Running WPA

Open a command prompt window and type wpa.exe or click the tile “Windows Performance Analyzer” as shown below:

Select the file option in the main menu to open the trace file generated by WPR.

Go to the folder where the data file is stored, select and open it.  By default, the data file is in the folder “WPR Files” under the folder “My Documents.”



Next, select the “Trace” option in the main menu, and then the “Load Symbols”.  This step is needed to load the debug symbols so that WPA can trace to the called system APIs.  Otherwise, the symbol “?” will be displayed, instead. 


If this is your first time running WPA, you will need to connect to the internet to download the symbols from the web.  The symbols stored in “.pdb” files will be automatically saved to the folder “C:\symbols.” 

You can also configure the symbol path by selecting the option “Configure Symbol paths.”

Expand the computation section by clicking on the arrow key on the left side of the word computation as shown below.


The screen will look like this:


Double-click on the “CPU Usage (Precise) Utilization by Process, Thread” (shown in the red rectangular below) section to display the CPU utilization graph by processes and threads.


To display the data table, click the icon as shown in the screen below.


The screen will look like this:

The graph illustrates that CPU utilization is very high being nearly 15% in some points (blue line).  Normally, during idle, the CPU utilization should be from 0.2% - 2%.


Move the cursor to the blue line to identify the process ID.


The line shows process ID 1484, and we need to analyze it to see what is going on.  Close the graph and click the vertical tab “Graph Explorer”, select the option “Timeline by Process, Thread” under “CPU Usage (Precise)”.  It should look like this:


Here we displayed the graph in one second of duration.  Three threads (3644, 2148 and 3064) are periodically active at approximately 11ms.  This is not ideal since the default platform timer period is 15.6ms.  We need to go deeper into each thread to see what system APIs get called.  The screen below shows what threads are calling the system function “WaitForSingleObject.”  This function has a high overhead and should be used only when necessary in order to minimize power consumption.


WPR and WPA are useful tools to collect and analyze data, respectively.  WPA allows users to do a deep system analysis to figure out the cause of power issues.

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.