cpu

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryUltra  api.MetricCategory = "cpu_ultra_fast"
	CategoryMedium api.MetricCategory = "cpu_medium"
)
View Source
const (
	CommandSetScalingRange api.CommandType = "cpu_scaling_range"
	CommandSetGovernor     api.CommandType = "cpu_governor"
	CommandSetUncoreRange  api.CommandType = "cpu_uncore_range"
	CommandSetPowerCap     api.CommandType = "cpu_power_cap"
)

Variables

This section is empty.

Functions

func DiscoverPackageTemperatureInputs

func DiscoverPackageTemperatureInputs(mappings []CoreMapping) map[int]string

func DiscoverThermalZones

func DiscoverThermalZones() []string

func DiscoverTopology

func DiscoverTopology() (StaticInfo, []CoreMapping, error)

Types

type Collector

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

func NewCollector

func NewCollector(static StaticInfo, mappings []CoreMapping, packageTemps map[int]string) *Collector

func (*Collector) CollectMedium

func (c *Collector) CollectMedium() (*MediumMetrics, error)

func (*Collector) CollectUltra

func (c *Collector) CollectUltra() (*UltraMetrics, error)

func (*Collector) Devices

func (c *Collector) Devices() []DeviceInfo

func (*Collector) PackageControls

func (c *Collector) PackageControls() []PackageControlInfo

func (*Collector) StaticInfo

func (c *Collector) StaticInfo() StaticInfo

func (*Collector) WaitWarmup

func (c *Collector) WaitWarmup(sampleInterval time.Duration)

type CollectorSpec

type CollectorSpec struct {
	Category string
	Interval string
}

type Controller

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

func NewController

func NewController(collector *Collector) *Controller

func (*Controller) SetGovernor

func (c *Controller) SetGovernor(packageID int, governor string) error

func (*Controller) SetPowerCap

func (c *Controller) SetPowerCap(pkgID int, microWatt uint64, domainRaw string) error

func (*Controller) SetScalingRange

func (c *Controller) SetScalingRange(packageID int, minKHz, maxKHz uint64) error

func (*Controller) SetUncoreRange

func (c *Controller) SetUncoreRange(pkgID int, minKHz, maxKHz uint64) error

type ControllerSpec

type ControllerSpec struct {
	Type string
}

type CoreFastMetrics

type CoreFastMetrics struct {
	CoreID        int
	Utilization   float64
	ScalingCurKHz uint64
	PackageID     int
	SampledAtNano int64
}

type CoreMapping

type CoreMapping struct {
	CoreID         int
	PackageID      int
	PhysicalCoreID int
	Vendor         string
	Model          string
}

type DeviceInfo

type DeviceInfo struct {
	PackageID   int
	Vendor      string
	Model       string
	CoreIDs     []int
	CoreCount   uint32
	ThreadCount uint32
}

type GovernorCommand

type GovernorCommand struct {
	Governor  string
	PackageID *int
}

type MediumMetrics

type MediumMetrics struct {
	Cores        []CoreFastMetrics
	Temperatures []PackageTemperature
}

type Module

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

func New

func New(intervals config.ReportConfig) (*Module, error)

func (*Module) CollectorEntries

func (m *Module) CollectorEntries() []modules.CollectorEntry

func (*Module) ControllerEntries

func (m *Module) ControllerEntries() []modules.ControllerEntry

func (*Module) Name

func (m *Module) Name() string

func (*Module) Registration

func (m *Module) Registration() any

type PackageControlInfo

type PackageControlInfo struct {
	PackageID             int
	ScalingMinKHz         uint64
	ScalingMaxKHz         uint64
	ScalingHWMinKHz       uint64
	ScalingHWMaxKHz       uint64
	AvailableGovernors    []string
	CurrentGovernor       string
	ScalingDriver         string
	UncoreCurrentKHz      uint64
	UncoreMinKHz          uint64
	UncoreMaxKHz          uint64
	PowerCapMicroW        uint64
	PowerCapMinMicroW     uint64
	PowerCapMaxMicroW     uint64
	DramPowerCapMicroW    uint64
	DramPowerCapMinMicroW uint64
	DramPowerCapMaxMicroW uint64
}

type PackagePowerCapRange

type PackagePowerCapRange struct {
	PackageID         int
	CurrentMicroW     uint64
	MinMicroWatt      uint64
	MaxMicroWatt      uint64
	DramCurrentMicroW uint64
	DramMinMicroWatt  uint64
	DramMaxMicroWatt  uint64
}

type PackageRAPL

type PackageRAPL struct {
	PackageID          int
	EnergyMicroJ       uint64
	PowerCapMicroW     uint64
	DramEnergyMicroJ   uint64
	DramPowerCapMicroW uint64
	SampledAtNano      int64
}

type PackageTemperature

type PackageTemperature struct {
	PackageID     int
	MilliC        uint32
	SampledAtNano int64
}

type PerCoreConfig

type PerCoreConfig struct {
	CoreID             int
	ScalingMinKHz      uint64
	ScalingMaxKHz      uint64
	AvailableGovernors []string
	CurrentGovernor    string
	ScalingDriver      string
	PackageID          int
	SampledAtNano      int64
}

type PowerCapCommand

type PowerCapCommand struct {
	PackageID int
	MicroWatt uint64
	Domain    string
}

type PowerCapDomain

type PowerCapDomain string
const (
	PowerCapDomainPackage PowerCapDomain = "package"
	PowerCapDomainDRAM    PowerCapDomain = "dram"
)

type Registration

type Registration struct {
	Static      StaticInfo
	Collectors  []CollectorSpec
	Controllers []ControllerSpec
	Devices     []DeviceInfo
	Controls    []PackageControlInfo
}

type ScalingRangeCommand

type ScalingRangeCommand struct {
	MinKHz    uint64
	MaxKHz    uint64
	PackageID *int
}

type StaticInfo

type StaticInfo struct {
	Vendor              string
	Model               string
	Packages            int
	PhysicalCores       int
	LogicalCores        int
	ThreadsPerCore      int
	CPUInfoMinKHz       uint64
	CPUInfoMaxKHz       uint64
	SupportsIntelUncore bool
	SupportsRAPL        bool
}

type UltraMetrics

type UltraMetrics struct {
	PerCore []PerCoreConfig
	RAPL    []PackageRAPL
	Uncore  []UncoreMetrics
}

type UncoreMetrics

type UncoreMetrics struct {
	PackageID     int
	CurrentKHz    uint64
	MinKHz        uint64
	MaxKHz        uint64
	InitialMinKHz uint64
	InitialMaxKHz uint64
	SampledAtNano int64
}

type UncoreRangeCommand

type UncoreRangeCommand struct {
	PackageID int
	MinKHz    uint64
	MaxKHz    uint64
}

Jump to

Keyboard shortcuts

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