Here, you will learn what the Intel Power Gadget is and what it does. In this video, you will see the Intel Developer Zone and features for the tool like power graphs, power logging and API usage which developers can use to profile a particular segment of code within their application. This tool is supported on Intel cores starting from 2nd generation (codenamed SandyBridge).
- The Intel Power Gadget will be used to find out if one of our applications is power hungry, or not. By power hungry, I mean the application consumes a high amount of power which will cause the battery life on your mobile device to drain at a much faster rate. The Intel Power Gadget provides a nice overview of your system's overall power consumption and how that changes according your application's behavior. From the power your application consumes when it is in idle mode to the power it consumes when it is responding to user input.
The Intel Power Gadget provides real-time estimations on the processor package power consumption. The processor package power consumption is the power consumed by both the CPU and the graphics, and it provides this information in logs. The tool provides other information such as processor frequency, graphics frequency, package temperature, and other metrics. It obtains this information by reading model-specific registers, commonly called MSRs, and by reading the energy counters that reside on Intel Core Processors, 2nd generation and later.
The Intel Power Gadget has three components associated with it. The first component, and the one we will be using is the command line version of the tool called Power Log. This provides the most options when it comes to collecting power data and it has the smallest overhead, meaning the Intel Power Gadget tool itself will be consuming the least amount of power versus the other component, that is the graphical user interface, the GUI. The GUI component provides real-time graphs of the package power consumption, package frequency, and package temperature.
If you go to the Intel Power Gadget desktop icon and double-click on it, the GUI comes up which displays these graphs. If you right-click on the GUI and select Options, you can change the rate at which the graphs update as well as the sampling rate. The sampling rate is the rate at which each sample is read, meaning how frequently a row of data is written to the log file. The GUI component has more overhead than the command line version of the tool. The third and last component of the tool is the C++ API that can only be used on Win32 desktop applications.
This constraint means it cannot be used on universal Windows applications that were introduced in Windows 10. Now if you have a C++ desktop application, you can use the API within your source code to power profile specific functions within your code rather than having to look at the entire application as a whole. Here is a template of a typical use of the API. First, you want to include the IntelPowerGadgetLib header file to get access to the API itself.
Then, you want to initialize the library. Make a start log function call where you pass in the name of the log file to be generated. Then specify how many samples you want read, which means how many rows in your log file you want filled with data. Then set the sampling rate with a sleep call. That is essentially the same as changing the sampling rate in the GUI. So a sleep of 100 means that every 100 milliseconds you want to execute your function followed by call to read sample which then collects power data information that is written to a row in the log file.
Lastly, after enough samples have been read, you make a call to stop log which then closes the log file. This common usage template is included in the exercise files, but due to the constraints of the API, and the additional overhead of using the GUI component, we will be using the command line version of the tool to power profile a universal Windows platform DirectX 11 jigsaw puzzle application which looks like this. Now we are going to use the Intel Power Gadget to inspect the power consumption behavior of the application.
How the application consumes power when it simply sits in idle mode, which is seen here, to the power it consumes when it responds to user input. We are then going to look at optimization techniques for reducing the power consumption of this application.
With these diagnostic tools and some efficient programming, you can reduce your app's power consumption while improving its response times. In this course, Thomas Pantels introduces a handful of tools used to measure and optimize power consumption. You will see demos on how to use the Intel Power Gadget, Windows Performance Toolkit, TypePerf, and SoC Watch, along with some simple coding tips for making any Windows app more energy efficient.
- Collecting and analyzing power data with Intel Power Gadget
- Implementing a rendering state machine
- Collecting and analyzing data with the Windows Performance Toolkit
- Understanding idle states, call stack walking, and thread activity
- Windows OS Timer Tick Resolution Rate change
- Optimization techniques to make your app power efficient
- Collecting, analyzing, and comparing data with Windows TypePerf and SoC Watch