Documentation ¶
Index ¶
- Constants
- Variables
- func InitAvailableParamAndMetrics()
- type CPUModelData
- type ContainerMetrics
- func (c *ContainerMetrics) GetBasicValues() []string
- func (c *ContainerMetrics) ResetDeltaValues()
- func (c *ContainerMetrics) SetLatestProcess(cgroupPID, pid uint64, comm string)
- func (c *ContainerMetrics) String() string
- func (c *ContainerMetrics) SumAllDynAggrValues() uint64
- func (c *ContainerMetrics) SumAllDynDeltaValues() uint64
- func (c *ContainerMetrics) ToEstimatorValues() (values []float64)
- func (c *ContainerMetrics) ToPrometheusValue(metric string) string
- type NodeMetrics
- func (ne *NodeMetrics) AddNodeGPUEnergy(gpuEnergy []uint32)
- func (ne *NodeMetrics) AddNodeResUsageFromContainerResUsage(containersMetrics map[string]*ContainerMetrics)
- func (ne *NodeMetrics) CalcDynEnergy(component, id string)
- func (ne *NodeMetrics) CalcIdleEnergy(component string)
- func (ne *NodeMetrics) GetAggrDynEnergyPerID(component, id string) uint64
- func (ne *NodeMetrics) GetAggrIdleEnergyPerID(component, id string) uint64
- func (ne *NodeMetrics) GetDeltaDynEnergyPerID(component, id string) uint64
- func (ne *NodeMetrics) GetDeltaIdleEnergyPerID(component, id string) uint64
- func (ne *NodeMetrics) GetNodeResUsagePerResType(resource string) float64
- func (ne *NodeMetrics) GetSumAggrDynEnergyFromAllSources(component string) uint64
- func (ne *NodeMetrics) GetSumAggrIdleEnergyromAllSources(component string) uint64
- func (ne *NodeMetrics) GetSumDeltaDynEnergyFromAllSources(component string) uint64
- func (ne *NodeMetrics) GetSumDeltaIdleEnergyromAllSources(component string) uint64
- func (ne *NodeMetrics) ResetDeltaValues()
- func (ne *NodeMetrics) SetLastestPlatformEnergy(platformEnergy map[string]float64)
- func (ne *NodeMetrics) SetNodeComponentsEnergy(componentsEnergy map[int]source.NodeComponentsEnergy)
- func (ne *NodeMetrics) SetNodeOtherComponentsEnergy()
- func (ne *NodeMetrics) String() string
- func (ne *NodeMetrics) UpdateDynEnergy()
- func (ne *NodeMetrics) UpdateIdleEnergy()
- type ProcessMetrics
- func (p *ProcessMetrics) GetBasicValues() []string
- func (p *ProcessMetrics) ResetDeltaValues()
- func (p *ProcessMetrics) String() string
- func (p *ProcessMetrics) SumAllDynAggrValues() uint64
- func (p *ProcessMetrics) SumAllDynDeltaValues() uint64
- func (p *ProcessMetrics) ToEstimatorValues() (values []float64)
- func (p *ProcessMetrics) ToPrometheusValue(metric string) string
- type UInt64Stat
- func (s *UInt64Stat) AddNewDelta(newDelta uint64) error
- func (s *UInt64Stat) ResetDeltaValues()
- func (s *UInt64Stat) SetNewAggr(newAggr uint64) error
- func (s *UInt64Stat) SetNewDelta(newDelta uint64) error
- func (s *UInt64Stat) SetNewDeltaValue(newDelta uint64, sum bool) error
- func (s UInt64Stat) String() string
- type UInt64StatCollection
- func (s *UInt64StatCollection) AddDeltaStat(key string, newDelta uint64)
- func (s *UInt64StatCollection) ResetDeltaValues()
- func (s *UInt64StatCollection) SetAggrStat(key string, newAggr uint64)
- func (s *UInt64StatCollection) SetDeltaStat(key string, newDelta uint64)
- func (s UInt64StatCollection) String() string
- func (s *UInt64StatCollection) SumAllAggrValues() uint64
- func (s *UInt64StatCollection) SumAllDeltaValues() uint64
Constants ¶
const ( CORE = "core" DRAM = "dram" UNCORE = "uncore" PKG = "pkg" GPU = "gpu" OTHER = "other" PLATFORM = "platform" FREQUENCY = "frequency" )
const ( // TO-DO: merge to cgroup stat ByteReadLabel = config.BytesReadIO ByteWriteLabel = config.BytesWriteIO DeltaPrefix = "curr_" AggrPrefix = "total_" )
Variables ¶
var ( // ContainerMetricNames holds the list of names of the container metric ContainerMetricNames []string // ContainerFloatFeatureNames holds the feature name of the container float collector_metric. This is specific for the machine-learning based models. ContainerFloatFeatureNames []string = []string{} // ContainerIOStatMetricsNames holds the cgroup IO metric name ContainerIOStatMetricsNames []string = []string{ByteReadLabel, ByteWriteLabel} // ContainerUintFeaturesNames holds the feature name of the container utint collector_metric. This is specific for the machine-learning based models. ContainerUintFeaturesNames []string // ContainerFeaturesNames holds all the feature name of the container collector_metric. This is specific for the machine-learning based models. ContainerFeaturesNames []string )
var ( NodeName = getNodeName() NodeCPUArchitecture = getCPUArch() // TODO: the metada should be a map and not two slices // NodeMetricNames holds the name of the system metadata information. NodeMetadataNames []string = []string{"cpu_architecture"} // SystemMetadata holds the metadata regarding the system information NodeMetadataValues []string = []string{NodeCPUArchitecture} )
var ( // ProcessMetricNames holds the list of names of the container metric ProcessMetricNames []string // ProcessFloatFeatureNames holds the feature name of the container float collector_metric. This is specific for the machine-learning based models. ProcessFloatFeatureNames []string = []string{} // ProcessUintFeaturesNames holds the feature name of the container utint collector_metric. This is specific for the machine-learning based models. ProcessUintFeaturesNames []string // ProcessFeaturesNames holds all the feature name of the container collector_metric. This is specific for the machine-learning based models. ProcessFeaturesNames []string )
var ( // AvailableEBPFCounters holds a list of eBPF counters that might be collected AvailableEBPFCounters []string // AvailableHWCounters holds a list of hardware counters that might be collected AvailableHWCounters []string // AvailableCgroupMetrics holds a list of cgroup metrics exposed by the cgroup that might be collected AvailableCgroupMetrics []string // AvailableKubeletMetrics holds a list of cgrpup metrics exposed by kubelet that might be collected AvailableKubeletMetrics []string // CPUHardwareCounterEnabled defined if hardware counters should be accounted and exported CPUHardwareCounterEnabled = false )
var CPUModelDataPath = "/var/lib/kepler/data/normalized_cpu_arch.csv"
Functions ¶
func InitAvailableParamAndMetrics ¶
func InitAvailableParamAndMetrics()
Types ¶
type CPUModelData ¶
type CPUModelData struct {
Architecture string `csv:"Architecture"`
}
type ContainerMetrics ¶
type ContainerMetrics struct { ProcessMetrics CGroupPID uint64 PIDS []uint64 ContainerName string PodName string Namespace string CurrProcesses int Disks int CgroupFSStats map[string]*UInt64StatCollection KubeletStats map[string]*UInt64Stat BytesRead *UInt64StatCollection BytesWrite *UInt64StatCollection }
func NewContainerMetrics ¶
func NewContainerMetrics(containerName, podName, podNamespace string) *ContainerMetrics
NewContainerMetrics creates a new ContainerMetrics instance
func (*ContainerMetrics) GetBasicValues ¶
func (c *ContainerMetrics) GetBasicValues() []string
GetBasicValues return basic label balues
func (*ContainerMetrics) ResetDeltaValues ¶
func (c *ContainerMetrics) ResetDeltaValues()
ResetCurr reset all current value to 0
func (*ContainerMetrics) SetLatestProcess ¶
func (c *ContainerMetrics) SetLatestProcess(cgroupPID, pid uint64, comm string)
SetLatestProcess set cgroupPID, PID, and command to the latest captured process NOTICE: can lose main container info for multi-container pod
func (*ContainerMetrics) String ¶
func (c *ContainerMetrics) String() string
func (*ContainerMetrics) SumAllDynAggrValues ¶
func (c *ContainerMetrics) SumAllDynAggrValues() uint64
func (*ContainerMetrics) SumAllDynDeltaValues ¶
func (c *ContainerMetrics) SumAllDynDeltaValues() uint64
func (*ContainerMetrics) ToEstimatorValues ¶
func (c *ContainerMetrics) ToEstimatorValues() (values []float64)
ToEstimatorValues return values regarding metricNames
func (*ContainerMetrics) ToPrometheusValue ¶
func (c *ContainerMetrics) ToPrometheusValue(metric string) string
ToPrometheusValue return the value regarding metric label
type NodeMetrics ¶
type NodeMetrics struct { ResourceUsage map[string]float64 TotalEnergyInCore *UInt64StatCollection TotalEnergyInDRAM *UInt64StatCollection TotalEnergyInUncore *UInt64StatCollection TotalEnergyInPkg *UInt64StatCollection TotalEnergyInGPU *UInt64StatCollection TotalEnergyInOther *UInt64StatCollection TotalEnergyInPlatform *UInt64StatCollection DynEnergyInCore *UInt64StatCollection DynEnergyInDRAM *UInt64StatCollection DynEnergyInUncore *UInt64StatCollection DynEnergyInPkg *UInt64StatCollection DynEnergyInGPU *UInt64StatCollection DynEnergyInOther *UInt64StatCollection DynEnergyInPlatform *UInt64StatCollection IdleEnergyInCore *UInt64StatCollection IdleEnergyInDRAM *UInt64StatCollection IdleEnergyInUncore *UInt64StatCollection IdleEnergyInPkg *UInt64StatCollection IdleEnergyInGPU *UInt64StatCollection IdleEnergyInOther *UInt64StatCollection IdleEnergyInPlatform *UInt64StatCollection CPUFrequency map[int32]uint64 // IdleCPUUtilization is used to determine idle periods IdleCPUUtilization uint64 FoundNewIdleState bool }
func NewNodeMetrics ¶
func NewNodeMetrics() *NodeMetrics
func (*NodeMetrics) AddNodeGPUEnergy ¶
func (ne *NodeMetrics) AddNodeGPUEnergy(gpuEnergy []uint32)
AddNodeGPUEnergy adds the lastest energy consumption of each GPU power consumption. Right now we don't support other types of accelerators than GPU, but we will in the future.
func (*NodeMetrics) AddNodeResUsageFromContainerResUsage ¶
func (ne *NodeMetrics) AddNodeResUsageFromContainerResUsage(containersMetrics map[string]*ContainerMetrics)
AddNodeResResourceUsageFromContainerResResourceUsage adds the sum of all container resource usage as the node resource usage
func (*NodeMetrics) CalcDynEnergy ¶
func (ne *NodeMetrics) CalcDynEnergy(component, id string)
func (*NodeMetrics) CalcIdleEnergy ¶
func (ne *NodeMetrics) CalcIdleEnergy(component string)
func (*NodeMetrics) GetAggrDynEnergyPerID ¶
func (ne *NodeMetrics) GetAggrDynEnergyPerID(component, id string) uint64
GetAggrDynEnergyPerID returns the delta dynamic energy from all source (e.g. package or gpu ids)
func (*NodeMetrics) GetAggrIdleEnergyPerID ¶
func (ne *NodeMetrics) GetAggrIdleEnergyPerID(component, id string) uint64
GetAggrIdleEnergyPerID returns the aggr idle energy for a given id
func (*NodeMetrics) GetDeltaDynEnergyPerID ¶
func (ne *NodeMetrics) GetDeltaDynEnergyPerID(component, id string) uint64
GetDeltaDynEnergyPerID returns the delta dynamic energy from all source (e.g. package or gpu ids)
func (*NodeMetrics) GetDeltaIdleEnergyPerID ¶
func (ne *NodeMetrics) GetDeltaIdleEnergyPerID(component, id string) uint64
GetDeltaIdleEnergyPerID returns the delta idle energy from all source (e.g. package or gpu ids)
func (*NodeMetrics) GetNodeResUsagePerResType ¶
func (ne *NodeMetrics) GetNodeResUsagePerResType(resource string) float64
func (*NodeMetrics) GetSumAggrDynEnergyFromAllSources ¶
func (ne *NodeMetrics) GetSumAggrDynEnergyFromAllSources(component string) uint64
GetSumAggrDynEnergyFromAllSources returns the sum of delta dynamic energy of all source (e.g. package or gpu ids)
func (*NodeMetrics) GetSumAggrIdleEnergyromAllSources ¶
func (ne *NodeMetrics) GetSumAggrIdleEnergyromAllSources(component string) uint64
GetSumAggrIdleEnergyromAllSources returns the sum of delta idle energy of all source (e.g. package or gpu ids)
func (*NodeMetrics) GetSumDeltaDynEnergyFromAllSources ¶
func (ne *NodeMetrics) GetSumDeltaDynEnergyFromAllSources(component string) uint64
GetSumDeltaDynEnergyFromAllSources returns the sum of delta dynamic energy of all source (e.g. package or gpu ids)
func (*NodeMetrics) GetSumDeltaIdleEnergyromAllSources ¶
func (ne *NodeMetrics) GetSumDeltaIdleEnergyromAllSources(component string) uint64
GetSumDeltaIdleEnergyromAllSources returns the sum of delta idle energy of all source (e.g. package or gpu ids)
func (*NodeMetrics) ResetDeltaValues ¶
func (ne *NodeMetrics) ResetDeltaValues()
func (*NodeMetrics) SetLastestPlatformEnergy ¶
func (ne *NodeMetrics) SetLastestPlatformEnergy(platformEnergy map[string]float64)
SetLastestPlatformEnergy adds the lastest energy consumption from the node sensor
func (*NodeMetrics) SetNodeComponentsEnergy ¶
func (ne *NodeMetrics) SetNodeComponentsEnergy(componentsEnergy map[int]source.NodeComponentsEnergy)
SetNodeComponentsEnergy adds the lastest energy consumption collected from the node's components (e.g., using RAPL)
func (*NodeMetrics) SetNodeOtherComponentsEnergy ¶
func (ne *NodeMetrics) SetNodeOtherComponentsEnergy()
SetNodeOtherComponentsEnergy adds the lastest energy consumption collected from the other node's components than CPU and DRAM Other components energy is a special case where the energy is calculated and not measured
func (*NodeMetrics) String ¶
func (ne *NodeMetrics) String() string
func (*NodeMetrics) UpdateDynEnergy ¶
func (ne *NodeMetrics) UpdateDynEnergy()
UpdateDynEnergy calculates the dynamic energy
func (*NodeMetrics) UpdateIdleEnergy ¶
func (ne *NodeMetrics) UpdateIdleEnergy()
type ProcessMetrics ¶
type ProcessMetrics struct { PID uint64 Command string CounterStats map[string]*UInt64Stat // ebpf metrics CPUTime *UInt64Stat SoftIRQCount []UInt64Stat GPUStats map[string]*UInt64Stat DynEnergyInCore *UInt64Stat DynEnergyInDRAM *UInt64Stat DynEnergyInUncore *UInt64Stat DynEnergyInPkg *UInt64Stat DynEnergyInGPU *UInt64Stat DynEnergyInOther *UInt64Stat IdleEnergyInCore *UInt64Stat IdleEnergyInDRAM *UInt64Stat IdleEnergyInUncore *UInt64Stat IdleEnergyInPkg *UInt64Stat IdleEnergyInGPU *UInt64Stat IdleEnergyInOther *UInt64Stat }
func NewProcessMetrics ¶
func NewProcessMetrics(pid uint64, command string) *ProcessMetrics
NewProcessMetrics creates a new ProcessMetrics instance
func (*ProcessMetrics) GetBasicValues ¶
func (p *ProcessMetrics) GetBasicValues() []string
GetBasicValues return basic label balues
func (*ProcessMetrics) ResetDeltaValues ¶
func (p *ProcessMetrics) ResetDeltaValues()
ResetCurr reset all current value to 0
func (*ProcessMetrics) String ¶
func (p *ProcessMetrics) String() string
func (*ProcessMetrics) SumAllDynAggrValues ¶
func (p *ProcessMetrics) SumAllDynAggrValues() uint64
func (*ProcessMetrics) SumAllDynDeltaValues ¶
func (p *ProcessMetrics) SumAllDynDeltaValues() uint64
func (*ProcessMetrics) ToEstimatorValues ¶
func (p *ProcessMetrics) ToEstimatorValues() (values []float64)
ToEstimatorValues return values regarding metricNames
func (*ProcessMetrics) ToPrometheusValue ¶
func (p *ProcessMetrics) ToPrometheusValue(metric string) string
ToPrometheusValue return the value regarding metric label
type UInt64Stat ¶
func (*UInt64Stat) AddNewDelta ¶
func (s *UInt64Stat) AddNewDelta(newDelta uint64) error
AddNewDelta sum a new read delta value (e.g., from bpf table that is reset, computed delta energy)
func (*UInt64Stat) ResetDeltaValues ¶
func (s *UInt64Stat) ResetDeltaValues()
ResetDelta resets current value
func (*UInt64Stat) SetNewAggr ¶
func (s *UInt64Stat) SetNewAggr(newAggr uint64) error
SetNewAggr set new read aggregated value (e.g., from cgroup, energy files)
func (*UInt64Stat) SetNewDelta ¶
func (s *UInt64Stat) SetNewDelta(newDelta uint64) error
SetNewDelta replace the delta value with a new read delta value (e.g., from bpf table that is reset, computed delta energy)
func (*UInt64Stat) SetNewDeltaValue ¶
func (s *UInt64Stat) SetNewDeltaValue(newDelta uint64, sum bool) error
SetNewDeltaValue sum or replace the delta value with a new read delta value
func (UInt64Stat) String ¶
func (s UInt64Stat) String() string
type UInt64StatCollection ¶
type UInt64StatCollection struct {
Stat map[string]*UInt64Stat
}
UInt64StatCollection keeps a collection of UInt64Stat
func (*UInt64StatCollection) AddDeltaStat ¶
func (s *UInt64StatCollection) AddDeltaStat(key string, newDelta uint64)
func (*UInt64StatCollection) ResetDeltaValues ¶
func (s *UInt64StatCollection) ResetDeltaValues()
func (*UInt64StatCollection) SetAggrStat ¶
func (s *UInt64StatCollection) SetAggrStat(key string, newAggr uint64)
func (*UInt64StatCollection) SetDeltaStat ¶
func (s *UInt64StatCollection) SetDeltaStat(key string, newDelta uint64)
func (UInt64StatCollection) String ¶
func (s UInt64StatCollection) String() string
func (*UInt64StatCollection) SumAllAggrValues ¶
func (s *UInt64StatCollection) SumAllAggrValues() uint64
SumAllAggrValues aggregates the aggregated metrics of all sources (i.e., stat keys)
func (*UInt64StatCollection) SumAllDeltaValues ¶
func (s *UInt64StatCollection) SumAllDeltaValues() uint64
SumAllDeltaValues aggregates the delta metrics of all sources (i.e., stat keys)