LIKWID
Classes | Macros | Typedefs | Enumerations | Functions | Variables
Power and Energy monitoring module

Classes

struct  PowerData
 Power measurement data for start/stop measurements. More...
 
struct  PowerDomain
 Structure describing an RAPL power domain. More...
 
struct  PowerInfo
 Information structure of CPU's power measurement facility. More...
 
struct  TurboBoost
 Information structure of CPU's turbo mode. More...
 

Macros

#define NUM_POWER_DOMAINS   5
 
#define POWER_DOMAIN_SUPPORT_INFO   (1ULL<<4)
 
#define POWER_DOMAIN_SUPPORT_LIMIT   (1ULL<<1)
 
#define POWER_DOMAIN_SUPPORT_PERF   (1ULL<<3)
 
#define POWER_DOMAIN_SUPPORT_POLICY   (1ULL<<2)
 
#define POWER_DOMAIN_SUPPORT_STATUS   (1ULL<<0)
 

Typedefs

typedef PowerDataPowerData_t
 Pointer for exporting the PowerData data structure.
 
typedef PowerInfoPowerInfo_t
 Pointer for exporting the PowerInfo data structure.
 

Enumerations

enum  PowerType {
  PKG = 0, PP0 = 1, PP1 = 2, DRAM = 3,
  PLATFORM = 4
}
 Enum for all supported RAPL domains. More...
 

Functions

const char *power_names[NUM_POWER_DOMAINS__attribute__ ((visibility("default")))
 List of all RAPL domain names.
 
PowerInfo_t get_powerInfo (void) __attribute__((visibility("default")))
 Get a pointer to the energy facility information. More...
 
void power_finalize (void) __attribute__((visibility("default")))
 Free space of power_unit.
 
double power_getEnergyUnit (int domain) __attribute__((visibility("default")))
 Get energy Unit. More...
 
int power_init (int cpuId) __attribute__((visibility("default")))
 Initialize energy measurements on specific CPU. More...
 
int power_limitGet (int cpuId, PowerType domain, double *power, double *time) __attribute__((visibility("default")))
 Get the values of the limit register of a domain NOT IMPLEMENTED. More...
 
int power_limitSet (int cpuId, PowerType domain, double power, double time, int doClamping) __attribute__((visibility("default")))
 Set the values of the limit register of a domain NOT IMPLEMENTED. More...
 
int power_limitState (int cpuId, PowerType domain) __attribute__((visibility("default")))
 Get the state of a energy limit, activated or deactivated NOT IMPLEMENTED. More...
 
double power_printEnergy (const PowerData *data) __attribute__((visibility("default")))
 Print energy measurements gathered by power_start() and power_stop() More...
 
int power_read (int cpuId, uint64_t reg, uint32_t *data) __attribute__((visibility("default")))
 Read the current power value. More...
 
int power_start (PowerData_t data, int cpuId, PowerType type) __attribute__((visibility("default")))
 Start energy measurements. More...
 
int power_stop (PowerData_t data, int cpuId, PowerType type) __attribute__((visibility("default")))
 Stop energy measurements. More...
 
int power_tread (int socket_fd, int cpuId, uint64_t reg, uint32_t *data) __attribute__((visibility("default")))
 Read the current energy value using a specific communication socket. More...
 

Variables

PowerInfo power_info
 Variable holding the global power information structure.
 

Detailed Description

Macro Definition Documentation

#define NUM_POWER_DOMAINS   5

Amount of currently supported RAPL domains

#define POWER_DOMAIN_SUPPORT_INFO   (1ULL<<4)

Flag to check in PowerDomain's supportFlag if the info msr registers are available

#define POWER_DOMAIN_SUPPORT_LIMIT   (1ULL<<1)

Flag to check in PowerDomain's supportFlag if the limit msr registers are available

#define POWER_DOMAIN_SUPPORT_PERF   (1ULL<<3)

Flag to check in PowerDomain's supportFlag if the perf msr registers are available

#define POWER_DOMAIN_SUPPORT_POLICY   (1ULL<<2)

Flag to check in PowerDomain's supportFlag if the policy msr registers are available

#define POWER_DOMAIN_SUPPORT_STATUS   (1ULL<<0)

Flag to check in PowerDomain's supportFlag if the status msr registers are available

Enumeration Type Documentation

enum PowerType

Enum for all supported RAPL domains.

Enumerator
PKG 

PKG domain, mostly one CPU socket/package.

PP0 

PP0 domain, not clearly defined by Intel.

PP1 

PP1 domain, not clearly defined by Intel.

DRAM 

DRAM domain, the memory modules.

PLATFORM 

PLATFORM domain, the whole system (if powered through the main board)

Function Documentation

PowerInfo_t get_powerInfo ( void  )

Get a pointer to the energy facility information.

Returns
PowerInfo_t pointer
See also
PowerInfo_t
double power_getEnergyUnit ( int  domain)

Get energy Unit.

Parameters
[in]domainRAPL domain ID
Returns
Energy unit of the given RAPL domain
int power_init ( int  cpuId)

Initialize energy measurements on specific CPU.

Additionally, it reads basic information about the energy measurements like minimal measurement time.

Parameters
[in]cpuIdInitialize energy facility for this CPU
Returns
error code
int power_limitGet ( int  cpuId,
PowerType  domain,
double *  power,
double *  time 
)

Get the values of the limit register of a domain NOT IMPLEMENTED.

Parameters
[in]cpuIdCPU ID
[in]domainRAPL domain ID
[out]powerEnergy limit
[out]timeTime limit
Returns
error code
int power_limitSet ( int  cpuId,
PowerType  domain,
double  power,
double  time,
int  doClamping 
)

Set the values of the limit register of a domain NOT IMPLEMENTED.

Parameters
[in]cpuIdCPU ID
[in]domainRAPL domain ID
[in]powerEnergy limit
[in]timeTime limit
[in]doClampingActivate clamping (going below OS-requested power level)
Returns
error code
int power_limitState ( int  cpuId,
PowerType  domain 
)

Get the state of a energy limit, activated or deactivated NOT IMPLEMENTED.

Parameters
[in]cpuIdCPU ID
[in]domainRAPL domain ID
Returns
state, 1 for active, 0 for inactive
double power_printEnergy ( const PowerData data)

Print energy measurements gathered by power_start() and power_stop()

Parameters
[in]dataData structure holding start and stop values for energy measurements
Returns
Consumed energy in Joules
int power_read ( int  cpuId,
uint64_t  reg,
uint32_t *  data 
)

Read the current power value.

Parameters
[in]cpuIdRead energy facility for this CPU
[in]regEnergy register
[out]dataEnergy data
int power_start ( PowerData_t  data,
int  cpuId,
PowerType  type 
)

Start energy measurements.

Parameters
[in,out]dataData structure holding start and stop values for energy measurements
[in]cpuIdStart energy facility for this CPU
[in]typeWhich type should be measured
Returns
error code
int power_stop ( PowerData_t  data,
int  cpuId,
PowerType  type 
)

Stop energy measurements.

Parameters
[in,out]dataData structure holding start and stop values for energy measurements
[in]cpuIdStart energy facility for this CPU
[in]typeWhich type should be measured
Returns
error code
int power_tread ( int  socket_fd,
int  cpuId,
uint64_t  reg,
uint32_t *  data 
)

Read the current energy value using a specific communication socket.

Parameters
[in]socket_fdCommunication socket for the read operation
[in]cpuIdRead energy facility for this CPU
[in]regEnergy register
[out]dataEnergy data