libmsr  0.3.0
A friendlier interface to accessing MSRs on Intel platforms
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Functions
msr_turbo.c File Reference
#include <stdint.h>
#include <stdio.h>
#include "msr_core.h"
#include "msr_turbo.h"
#include "msr_rapl.h"
#include "memhdlr.h"
#include "libmsr_error.h"
#include "cpuid.h"
#include "libmsr_debug.h"
Include dependency graph for msr_turbo.c:

Functions

void turbo_storage (uint64_t ***val)
 Allocate array for storing raw register data from IA32_PERF_CTL.
 
void enable_turbo (void)
 Enable turbo by modifying IA32_PERF_CTL on each logical processor.
 
void disable_turbo (void)
 Disable turbo by modifying IA32_PERF_CTL on each logical processor.
 
void dump_turbo (FILE *writedest)
 Print turbo data for each logical processor.
 
void calc_max_non_turbo (const unsigned socket, struct turbo_activation_ratio_data *info)
 Convert raw bits of MSR_TURBO_ACTIVATION_RATIO to human-readable values.
 
int get_max_turbo_activation_ratio (const unsigned socket, struct turbo_activation_ratio_data *info)
 Read value of the MSR_TURBO_ACTIVATION_RATIO register and translate bit fields to human-readable values.
 
void calc_max_turbo_ratio (const unsigned socket, struct turbo_limit_data *info, struct turbo_limit_data *info2)
 Convert raw bits of turbo ratio limit register to human-readable values.
 
int get_turbo_ratio_limit (const unsigned socket, struct turbo_limit_data *info, struct turbo_limit_data *info2)
 Read value of the turbo ratio limit register and translate bit fields to human-readable values.
 

Function Documentation

void calc_max_non_turbo ( const unsigned  socket,
struct turbo_activation_ratio_data info 
)

Convert raw bits of MSR_TURBO_ACTIVATION_RATIO to human-readable values.

Parameters
[in]socketUnique socket/package identifier.
[out]infoData for turbo activation ratio.
void calc_max_turbo_ratio ( const unsigned  socket,
struct turbo_limit_data info,
struct turbo_limit_data info2 
)

Convert raw bits of turbo ratio limit register to human-readable values.

Parameters
[in]socketUnique socket/package identifier.
[out]infoData for turbo ratio limit.
[out]info2Data for turbo ratio limit 1 (platform dependent).
void disable_turbo ( void  )

Disable turbo by modifying IA32_PERF_CTL on each logical processor.

Disable Intel Dynamic Acceleration (IDA) and Intel Turbo Boost Technology by setting bit 32 of IA32_PERF_CTL to 1. This bit is not shared across logical processors in a package, so it must be modified to the same value across all logical processors in the same package.

void dump_turbo ( FILE *  writedest)

Print turbo data for each logical processor.

For each logical processor, print the unique core identifier, the value of bit 32 for IA32_PERF_CTL (1 indicates IDA/Turbo Boost is enabled) and the value of bit 38 for IA32_MISC_ENABLE (1 indicates support for IDA/Turbo Boost by the platform).

Parameters
[in]writedestFile stream where output will be written to.
void enable_turbo ( void  )

Enable turbo by modifying IA32_PERF_CTL on each logical processor.

Enable Intel Dynamic Acceleration (IDA) and Intel Turbo Boost Technology by setting bit 32 of IA32_PERF_CTL to 0. This bit is not shared across logical processors in a package, so it must be modified to the same value across all logical processors in the same package.

int get_max_turbo_activation_ratio ( const unsigned  socket,
struct turbo_activation_ratio_data info 
)

Read value of the MSR_TURBO_ACTIVATION_RATIO register and translate bit fields to human-readable values.

Parameters
[in]socketUnique socket/package identifier.
[out]infoData for turbo activation ratio.
Returns
0 if successful, else -1 if rapl_storage() fails.
int get_turbo_ratio_limit ( const unsigned  socket,
struct turbo_limit_data info,
struct turbo_limit_data info2 
)

Read value of the turbo ratio limit register and translate bit fields to human-readable values.

Parameters
[in]socketUnique socket/package identifier.
[out]infoData for turbo ratio limit.
[out]info2Data for turbo ratio limit 1 (platform dependent).
Returns
0 if successful, else -1 if rapl_storage() fails.
void turbo_storage ( uint64_t ***  val)

Allocate array for storing raw register data from IA32_PERF_CTL.

There are plans to use a struct to make the indirection less crazy.

Parameters
[in]valPointer to array of raw IA32_PERF_CTL data, length equal to the total number of logical processors.