rapl

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const MSRPowerUnit int64 = 0x606

MSRPowerUnit specifies the MSR for the MSR_RAPL_POWER_UNIT register

Variables

View Source
var DRAM = RAPLDomain{0x2, "DRAM", DomainMSRs{0x618, 0x619, 0x0, 0x61b, 0x61c}}

DRAM is the RAPL domain for the DRAM

View Source
var ErrMSRDoesNotExist = errors.New("MSR does not exist on selected Domain")

ErrMSRDoesNotExist is the error for instances when a Domain does not exist on a given RAPL domain

View Source
var PP0 = RAPLDomain{0x4, "PP0", DomainMSRs{0x638, 0x639, 0x63a, 0x63b, 0x0}}

PP0 is the RAPL domain for the processor core

View Source
var PP1 = RAPLDomain{0x8, "PP1", DomainMSRs{0x640, 0x641, 0x642, 0x0, 0x0}}

PP1 is platform-dependant, although it usually refers to some uncore power plane

View Source
var Package = RAPLDomain{0x1, "Package", DomainMSRs{0x610, 0x611, 0x0, 0x613, 0x614}}

Package is the RAPL domain for the CPU package

Functions

This section is empty.

Types

type DomainMSRs

type DomainMSRs struct {
	PowerLimit   int64
	EnergyStatus int64
	Policy       int64
	PerfStatus   int64
	PowerInfo    int64
}

DomainMSRs carries address locations for various MSR registers

type PowerLimitSetting

type PowerLimitSetting struct {
	//Sets the average power usage limits in Watts
	PowerLimit float64
	//Enables or disables the power limit
	EnableLimit bool
	//If enabled, this allows RAPL to turn down the processor frequency below what the OS has requested
	ClampingLimit bool
	//The time window,in seconds, over which the RAPL limit will be measured
	TimeWindowLimit float64
}

PowerLimitSetting specifies a power limit for a given time window

type RAPLDomain

type RAPLDomain struct {
	Mask uint
	Name string
	MSRs DomainMSRs
}

RAPLDomain is a string type that covers the various RAPL domains

type RAPLHandler

type RAPLHandler struct {
	// contains filtered or unexported fields
}

RAPLHandler manages a stateful connection to the RAPL system.

func CreateNewHandler

func CreateNewHandler(cpu int, fmtS string) (RAPLHandler, error)

CreateNewHandler creates a RAPL register handler for the given CPU

func (RAPLHandler) GetDomains

func (h RAPLHandler) GetDomains() []RAPLDomain

GetDomains returns the list of RAPL domains on the package

func (RAPLHandler) ReadEnergyStatus

func (h RAPLHandler) ReadEnergyStatus(domain RAPLDomain) (float64, error)

ReadEnergyStatus returns the MSR_[DOMAIN]_ENERGY_STATUS MSR This MSR is a single 32 bit field that reports the energy usage for the domain. Updated ~1ms. Every domain has this MSR. This is a cumulative register

func (RAPLHandler) ReadPerfStatus

func (h RAPLHandler) ReadPerfStatus(domain RAPLDomain) (float64, error)

ReadPerfStatus returns the MSR_[DOMAIN]_PERF_STATUS msr. This is a single value. The value is the amount of time that the domain has been throttled due to RAPL limits. This is not available on PP1.

func (RAPLHandler) ReadPolicy

func (h RAPLHandler) ReadPolicy(domain RAPLDomain) (uint64, error)

ReadPolicy returns the MSR_[DOMAIN]_POLICY msr. This constists of a single value. The value is a priority that balances energy between the core and uncore devices. It's only available on the PP0/PP1 domains.

func (RAPLHandler) ReadPowerInfo

func (h RAPLHandler) ReadPowerInfo(domain RAPLDomain) (RAPLPowerInfo, error)

ReadPowerInfo returns the MSR_[DOMAIN]_POWER_INFO MSR. This MSR is not available on PP0/PP1

func (RAPLHandler) ReadPowerLimit

func (h RAPLHandler) ReadPowerLimit(domain RAPLDomain) (RAPLPowerLimit, error)

ReadPowerLimit returns the MSR_[DOMAIN]_POWER_LIMIT MSR This MSR defines power limits for the given domain. Every domain has this MSR

func (RAPLHandler) ReadPowerUnit

func (h RAPLHandler) ReadPowerUnit() (RAPLPowerUnit, error)

ReadPowerUnit returns the MSR_RAPL_POWER_UNIT MSR This has no associated domain

type RAPLPowerInfo

type RAPLPowerInfo struct {
	ThermalSpecPower float64
	MinPower         float64
	MaxPower         float64
	MaxTimeWindow    float64
}

RAPLPowerInfo contains the data from the MSR_[DOMAIN]_POWER_INFO MSR

type RAPLPowerLimit

type RAPLPowerLimit struct {
	Limit1 PowerLimitSetting
	Limit2 PowerLimitSetting
	Lock   bool
}

RAPLPowerLimit contains the data in the MSR_[DOMAIN]_POWER_LIMIT MSR This MSR containers two power limits. From the SDM: "Two power limits can be specified, corresponding to time windows of different sizes" "Each power limit provides independent clamping control that would permit the processor cores to go below OS-requested state to meet the power limits."

type RAPLPowerUnit

type RAPLPowerUnit struct {
	//PowerUnits is a multiplier for power related information in watts
	PowerUnits float64
	//EnergyStatusUnits is a multiplier for energy related information in joules
	EnergyStatusUnits float64
	//TimeUnits is a multiplier for time related information in seconds
	TimeUnits float64
}

RAPLPowerUnit contains the data in the MSR_RAPL_POWER_UNIT MSR

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL