Using Intel® Power Gadget 2.0 to measure the energy performance of a compute-intensive application

Intel® Power Gadget 2.0 is a software-based power estimation tool enabled for Second Generation Intel® Core™ processors. It includes a Microsoft Windows* sidebar gadget, driver, and libraries to monitor and estimate real-time processor package power information in watts using the energy counters in the processor. The purpose of the gadget is to assist end-users, ISV's, OEM's, developers, etc., in more precise estimation of power from a software level without any hardware instrumentation (external power meter). Additional functionalities include estimation of power on multi-socket systems as well as externally callable APIs to extract power information within sections of code. The Intel Power Gadget 2.0 supports measurement both on battery and with the system plugged into an external AC power source.

For this article, I took a very compute-intensive parallel application that I wrote to solve instances of the logic puzzle Akari. The code uses a backtracking algorithm to explore how to place light bulbs onto a grid under constraints dictated by the rules of the puzzle and the layout of the puzzle instance. Potentially millions of independent tasks can be generated by the code as the solution space is searched by threads executing those tasks. This solution method is eminently scalable to a large number of threads and is able to keep many cores running at peak speed for a sustained amount of time.

Usage description

The most common usage of the Intel Power Gadget is through the Windows® 7 Sidebar gadget component. After installation (see gadget documentation for how to do this), you simply bring up the gadget from the Windows* Gadget Gallery.

Power Gadget Interface

Once the gadget is up, you are able to monitor processor power usage when running a workload or with the system idle. The two panes displayed by the gadget are the Power Pane, which shows a running graph of the power consumed by the CPU, and the Frequency Pane, which shows the a running graph of the CPU frequency of the CPU. Both panes display the last 110 seconds of data collected to enable a user to have some recent history of power consumption and CPU frequency. You can easily tell when an application is active or sitting idle by the ups and downs of the graph line. Just above the graph portion, each pane has a text result showing the current “instantaneous” measurement of power (Watts) or frequency (GHz). Additionally, the Frequency Pane graph has a line (and text) denoting the maximum frequency of the processor on which the gadget is currently running.

The size of the gadget on your screen can be altered by clicking on the Resize Button located on the right of the graph display. There are really only two sizes available, but it might make the data easier to read or else making the gadget smaller since it can’t actually be minimized.

You can customize the Sampling Resolution (msec) and Max Power (Watts) to be displayed in the gadget. Click on the Options Button to bring up a customization selection window. Both of these settings are modified through a slider interface. The Sampling Resolution setting will affect how often a measurement of the CPU power and frequency are taken by Power Gadget. The update speed of the graphs in gadget will be unaffected. The Max Power setting will affect what range of values along the vertical axis in the Power Pane. Since the maximum TDP (Thermal Design Power) rating on my workstation is 35W, I set this down to 30W to show off more detail in the graphical tracking of power usage.

Measuring the application

At the top of the customization window you can designate the file location of the comma-separated values (CSV) data generated by the gadget. When you are ready to record data from an application run, click the “Start Log” button. When you are done recording data, click the “Stop Log” button. The CSV data file will be in the location you have specified.

After getting things set up in the Power Gadget interface, there is nothing else special that you need to do to measure the energy consumption of your application. If there is a specific portion of the application to be measured, you can start the application running and start logging data from Power Gadget when the relevant point of the execution begins; then turn off logging when the interesting portion has ended. For my Akari solver application, the entire run was of interest. I first started logging with Power Gadget, waited about 5 seconds, and then launched my application. Once the application had completed, I waited 5 seconds and then stopped logging. The extra logging time before and after the application running was to help better distinguish when the application was actually running from the log data collected. It turned out that this wasn’t necessary.

Upon examination of the log data in the CSV file, I found that it was quite easy to determine when the application began running. The frequency of the processor tended to run around 800 MHz when the application wasn’t running (system at idle), but was consistently 2600 MHz (or 3100 MHz when running on AC power source) during the execution of my compute-intensive application. Thus, I could quickly identify the relevant data for my application runs within the CSV file.

What data is presented

As described above, the Intel Power Gadget GUI provides a graphic record of processor power (Watts) and frequency (GHz) in real-time. The last 110 seconds of data are shown in the display.

Within the CSV log file you will find the first three columns hold data for System Time (at each measurement point), RDTSC (ReaD Time Stamp Counter, the number of clock cycles since the CPU was powered up or reset), and Elapsed Time (seconds) from the time Power Gadget started logging to the end of logging. The next columns hold CPU Frequency (MHz), Package Power (Watts), Package Energy (Joules) and the cumulative Package Energy (milliwatt hours, mWh). These four columns will be replicated for each socket within the system. The column labels will indicate the socket from which the data was measured. For most systems there will be only one socket and CPU package involved. The column titles in that case will be suffixed with a zero (‘0’).

Some Results

The purpose of this article is not to determine the best scenario for running my Akari solver application in the most energy efficient way. You will want to do this for your application, though, and this article has given you the background on Intel Power Gadget to determine if this checker can help you quantify the current power consumption of your application. Also, as you make modifications to the application you will be able to determine if those changes improve the energy efficiency or cause your application to suck more power than before.

I did experiments when the platform was running on battery (DC) power and when plugged into the wall socket (AC) power. There was an obvious difference in execution time for the application between these two scenarios. The processor ran at a faster frequency when running on AC power and the execution times were shorter than corresponding runs on battery power. I also made measurement runs with and without Hyper-Threading Technology (HT) turned on and a number of different threads running.

While the absolute total energy consumed was different for the application running on DC or AC power, the relative amount of energy used as the number of threads varied was consistent between runs on battery or power cord. For example, when running with HT enabled and four threads on four logical cores, the speedup exhibited was just under 2.2X and the mWh measurement was 27% less than the serial execution on the same workload. There were similarly correlated measurements between runs where HT was disabled. In all cases, when using double the number of thread as logical cores available, the speedup was slightly lower and the measured mWh values were slightly higher than when using the exact number of thread to logical cores.

System Requirements

In order to use Intel Power Gadget, your test platform must be equipped with one (single socket) or more (multi-socket) 2nd Generation Intel® Core™ Processors. Previous processors are not supported. The supported operating systems include Microsoft Windows 7*, 32-bit and 64-bit versions, Microsoft Windows* Server 2008, and Microsoft Windows* Server 2008 RC2 (64-bit server platforms). In addition, you will need to have installed the Microsoft* .Net Framework 4 and Microsoft Visual C++ 2010 SP1 Redistributable package (x86 or x64 depending on OS). The presence of these final two installations will be checked at installation time and downloaded as needed.

A functionally identical version of Intel® Power Gadget 2.0 is now available for Mac OS X. However, there are some differences. Specifically, the Power Gadget GUI is an application as opposed to a desktop gadget and does not support multi-socket configurations. Additionally, the EzPwrLibrary API is written in Objective-C. You will need to be running the Mac OS X 10.6 or later version with a 2nd generation Intel® CoreTM processor or later

Download link

You can find download links within the article “Intel® Power Gadget 2.0” (

Other supporting links

A blog post on “Accessing Intel® Power Gadget 2.0 library in C++” describes how to use the Intel Power Gadget API and libraries from C++ code.

For more complete information about compiler optimizations, see our Optimization Notice.