Home » Intel » Using the Intel® Power Gadget 3.0 API on Windows*

Using the Intel® Power Gadget 3.0 API on Windows*

         

Authors:  Seung-Woo Kim, Joseph Jin-Sung Lee, Vardhan Dugar, Jun De Vega

1.Introduction

1.1 About Intel® Energy System for Home windows

Intel® Power Gadget for Windows is an application which presents real-time data about a 2nd generation or later Intel® Core processor regarding current estimated processor power, package power limit, current processor frequency, base frequency, GT frequency, current temperature, maximum temperature, proc hot (when package temperature exceeds max temperature) timestamps and elapsed time. The data is obtained from the Model Specific Registers (MSRs) and energy counters that are available only in 2nd Generation Intel® Core™ or later processors.  The PROCHOT feature is available only in 3rd Generation Intel® Core™ processors or later.

The supported MSRs are correlated with three MSR functions as described in Table 1. This data can be viewed on a Graphical User Interface (GUI) and/or logged for a required duration of time.

MSR Function

Data

Returns

0

Frequency

Frequency of sample (in MHz)

1

Power

Average Power (in Watts),
Cumulative Energy (in Joules),
Cumulative Energy (in milliWatt-Hours)

2

Temperature

Temperature (in Deg. Celsius)
Proc Hot (‘0’ if false and ‘1’ if true)

3

Package Power Limit

Package Power Limit (in Watts)

 Table 1: MSR functions 

Developers may use this data to create their own application by exploiting the Dynamic-Link Library (DLL) used by the Intel® Power Gadget. The DLL serves as a C++ Application Programming Interface (API). For more details on the API, please refer to subsequent sections.

1.2 Setup

  1. Download the appropriate Intel® Power Gadget installation package on your system.
  2. Run setup.exe as an administrator. Accept the UAC, if one appears.
  3. Follow the installer prompt instructions to complete installation. Microsoft .Net Framework 4 will automatically be downloaded from the Microsoft website if not yet installed in your system. Microsoft Visual C++ 2010 SP1 Redistributable Package will also automatically get installed if not yet installed.

For more information on system requirements and installation, please visit Intel® Power Gadget web page

2.Builders’ Instruments

The installer units two surroundings variables on set up:

  • IPG_Ver: Accommodates model of Intel® Energy System being put in.
  • IPG_Dir: Comprises listing wherein the DLLs (EnergyLib64.dll used for sixty four-bit purposes and EnergyLib32.dll used for 32-bit purposes) had been put in. 

Builders could make the most of the DLL for his or her 32-bit or sixty four-bit purposes. Pattern code referred to as “PowerLog3.zero-supply.zip” to make use of Intel®     Energy System’s DLL is to be had for obtain on the backside of this web page 

three.API of Intel® Energy Machine

three.1 Thought of Sampling

For a excellent working out of the API, it’s crucial to be conversant in the idea that of sampling. Information is obtained from particular MSRs at a hard and fast sampling frequency. Better the frequency, higher would be the accuracy of the information however poorer would be the efficiency of the machine. Even if the Intel® Energy Device API can be utilized with a sampling frequency starting from 1 to a thousand milliseconds, the most beneficial sampling frequency of one hundred milliseconds is the default choice on the GUI and is really helpful for utility builders.

three.2 Overview

As the main API, builders may just use Intel® Energy System’s EnergyLib32.dll for 32-bit purposes or EnergyLib64.dll for sixty four-bit purposes. This library have to be initialized on the start of this system through calling IntelEnergyLibInitialize(). Right here, the loading of the motive force takes position.

The ReadSample()perform is used to learn samples. ReadSample() obtains the choice of sampled MSRs from GetNumMsrs(). MSRs are given an ID from zero to n-1, the place n is the quantity lower back by means of GetNumMsrs(). The MSR ID is used to procure information for a particular MSR the use of GetMsrName(),GetMsrFunc() and GetPowerData() features. GetPowerData() is referred to as for every sampled MSR and gives the related information from that MSR. An MSR’s perform, which the API obtains from GetMsrFunc(), determines the quantity and which means of information again from GetPowerData() as described in Desk 1.  Due to the fact that GT frequency shouldn’t be acquired from MSRs, some other operate known as GetGTFrequency() will present this information. You can actually test if Intel® photos is to be had with the lend a hand of IsGTAvailable() operate prior to making an attempt to acquire GT associated knowledge.

ReadSample() additionally reads the gadget time by way of GetSysTime()on the time the pattern used to be learn. The time interval (in seconds) between samples is to be had by the use of GetTimeInterval().

Additional, the API helps studying from fashionable person MSRs without needing to specify the MSR handle or learn a whole pattern by means of GetIAFrequency(), GetMaxTemperature(), GetTemperature() and GetTDP().It is suggested that Bundle Energy Restrict is used as a substitute of TDP on every occasion imaginable, as it’s a extra correct higher sure to the package deal energy than TDP.

The pattern information from ReadSample() may also be logged to a file. Logging will also be started at any time by means of calling StartLog(), and therefore ended with the aid of calling StopLog().

For extra data on the API, discuss with the Operate Reference part.

four.Perform Reference

Perform

Description

1

bool IntelEnergyLibInitialize();

Initializes the library and connects to the motive force.

2

bool ReadSample();

Reads pattern knowledge from the motive force for all of the supported MSRs.

three

bool GetNumNodes(int *nNodes);

Returns the collection of CPU programs on the machine.

four

bool GetNumMsrs(int *nMsrs);

Returns the selection of supported MSRs for bulk studying and logging.

5

bool GetMsrName(int iMsr, wchar_t *szName);

Returns in szName the identify of the MSR distinct by way of iMsr.

6

bool GetMsrFunc(int iMsr, int *pFuncID);

Returns in pFuncID the perform of the MSR distinctive by means of MSR ID in iMsr. Refer Desk 1: MSR Features.

7

bool GetPowerData(int iNode, int iMSR, double *pResult, int *nResult);

Returns the info amassed via probably the most contemporary name to ReadSample(). The back information is for the information on the package deal precise by way of iNode, from the MSR distinctive via iMSR. The information is back in pResult, and the selection of double outcomes back in pResult is again in nResult. Refer Desk 1: MSR Features.

eight

bool IsGTAvailable();

Returns real if Intel® images is to be had and false if Intel® photos is unavailable (i.e if it’s no longer current or disabled).

9

bool GetGTFrequency(int *freq);

Returns the present GT frequency in MHz. The information is again in freq.

10

bool GetSysTime(void *pSysTime);

Returns the device time as of the final name to ReadSample(). The information back in pSysTime is structured as follows: pSysTime[63:32] = time in seconds ; pSysTime[31:0] = time in nanoseconds

eleven

bool GetTimeInterval(double *pOffset);

Returns in pOffset the time (in seconds) that has elapsed between the 2 most up to date calls to ReadSample().

12

bool GetIAFrequency(int iNode, int *freqInMHz);

Reads the processor frequency MSR on the package deal unique through iNode, and returns the frequency (in MHz) in freqInMHz.

thirteen

bool GetTDP(int iNode, double *TDP);

Reads the bundle energy information MSR on the bundle specific by using iNode, and returns the TDP (in Watts) in TDP. It’s endorsed that Package deal Energy Restrict is used as a substitute of TDP each time that you can think of, as it’s a extra correct higher sure to the package deal energy than TDP.

14

bool GetMaxTemperature(int iNode, int *degreeC);

Reads the temperature goal MSR on the bundle certain through iNode, and returns the utmost temperature (in levels Celsius) in degreeC.

15

bool GetTemperature(int iNode, int *degreeC);

Reads the temperature MSR on the bundle targeted by way of iNode, and returns the present temperature (in levels) Celsius in degreeC.

sixteen

bool GetBaseFrequency(int iNode, double *pBaseFrequency);

Returns in pBaseFrequency the marketed processor frequency for the bundle targeted via iNode.

17

bool StartLog(wchar_t *szFileName);

Begins saving the info accumulated by way of ReadSample() except StopLog() is referred to as. Information might be written to the file distinctive by using szFileName.

18

bool StopLog();

Stops saving information and writes all saved information to the file certain through the decision to StartLog().

Desk 2: Perform Look up
 

four.1 Notes of Warning

  1. The features described in Desk 2 return both actual on success or false on failure.
  2. It’s endorsed to first examine if Intel® portraits is to be had by means of IsGTAvailable() prior to trying to acquire GT frequency information by means of GetGTFrequency().
  3. The “PROCHOT” characteristic is on hand best in third Era Intel® Core™ processors or later.
  4. It’s endorsed that Package deal Energy Restrict is used as a substitute of TDP every time imaginable, as it’s a extra correct higher sure to the bundle energy than TDP.The ReadSample() operate should be referred to as twice ahead of calling GetTimeInterval() and sooner than getting energy information (versus frequency or temperature knowledge) from GetPowerData(), as they’re computed the usage of the adaptation between two samples.
  5. When logging knowledge, the information isn’t written into the log except StopLog() perform is known as. StartLog() will result in an preliminary name to ReadSample() and StopLog() motives the ultimate name.
  6. The GetRDTSC() perform has been deprecated from earlier variations of the DLL.

Incoming search terms:

  • intel power gadget