Documentation
¶
Index ¶
Constants ¶
const ( CPUModelDataPath = "/var/lib/kepler/data/cpus.yaml" CPUPmuNamePath = "/sys/devices/cpu/caps/pmu_name" CPUTopologyPath = "/sys/devices/system/cpu/cpu%d/topology/physical_package_id" )
const (
MockedSocketID = "socket0"
)
Variables ¶
var ( NodeName = GetNodeName() NodeCPUArchitecture = getCPUArch() NodeCPUPackageMap = getCPUPackageMap() // NodeMetricNames holds the name of the system metadata information. NodeMetadataFeatureNames []string = []string{"cpu_architecture"} // SystemMetadata holds the metadata regarding the system information NodeMetadataFeatureValues []string = []string{NodeCPUArchitecture} )
var ( // ProcessMetricNames holds the list of names of the container metric ProcessMetricNames []string // ProcessFeaturesNames holds all the feature name of the container stats. This is specific for the machine-learning based models. ProcessFeaturesNames []string )
var ( // AvailableBPFSWCounters holds a list of eBPF counters that might be collected AvailableBPFSWCounters []string // AvailableBPFHWCounters holds a list of hardware counters that might be collected AvailableBPFHWCounters []string // AvailableCGroupMetrics holds a list of cgroup metrics exposed by the cgroup that might be collected AvailableCGroupMetrics []string // AvailableAbsEnergyMetrics holds a list of absolute energy metrics AvailableAbsEnergyMetrics []string // AvailableDynEnergyMetrics holds a list of dynamic energy metrics AvailableDynEnergyMetrics []string // AvailableIdleEnergyMetrics holds a list of idle energy metrics AvailableIdleEnergyMetrics []string // CPUHardwareCounterEnabled defined if hardware counters should be accounted and exported CPUHardwareCounterEnabled = false )
var ( // VMMetricNames holds the list of names of the vm metric VMMetricNames []string // VMFloatFeatureNames holds the feature name of the vm float stats. This is specific for the machine-learning based models. VMFloatFeatureNames []string = []string{} // VMUintFeaturesNames holds the feature name of the vm utint stats. This is specific for the machine-learning based models. VMUintFeaturesNames []string // VMFeaturesNames holds all the feature name of the vm stats. This is specific for the machine-learning based models. VMFeaturesNames []string )
Functions ¶
func CreateMockedProcessStats ¶
func CreateMockedProcessStats(numContainers int) map[uint64]*ProcessStats
CreateMockedProcessStats adds two containers with all metrics initialized
func GetNodeName ¶
func GetNodeName() string
func InitAvailableParamAndMetrics ¶
func InitAvailableParamAndMetrics()
func SetMockedCollectorMetrics ¶
func SetMockedCollectorMetrics()
SetMockedCollectorMetrics adds all metric to a process, otherwise it will not create the right usageMetric with all elements. The usageMetric is used in the Prediction Power Models TODO: do not use a fixed usageMetric array in the power models, a structured data is more disarable.
Types ¶
type CPUModelData ¶
type ContainerStats ¶
type ContainerStats struct { Stats PIDS map[uint64]bool ContainerID string ContainerName string PodName string Namespace string CgroupStatHandler cgroup.CCgroupStatHandler CgroupStatMap map[string]*types.UInt64StatCollection }
func NewContainerStats ¶
func NewContainerStats(containerName, podName, podNamespace, containerID string) *ContainerStats
NewContainerStats creates a new ContainerStats instance
func (*ContainerStats) ResetDeltaValues ¶
func (c *ContainerStats) ResetDeltaValues()
ResetCurr reset all current value to 0
func (*ContainerStats) SetLatestProcess ¶
func (c *ContainerStats) SetLatestProcess(pid uint64)
SetLatestProcess set PID to the latest captured process NOTICE: can lose main container info for multi-container pod
func (*ContainerStats) String ¶
func (c *ContainerStats) String() string
func (*ContainerStats) UpdateCgroupMetrics ¶
func (c *ContainerStats) UpdateCgroupMetrics() error
type NodeStats ¶
type NodeStats struct { Stats // IdleResUtilization is used to determine idle pmap[string]eriods IdleResUtilization map[string]uint64 }
func CreateMockedNodeStats ¶
func CreateMockedNodeStats() NodeStats
CreateMockedNodeStats creates a node metric with power consumption and add the process resource utilization
func NewNodeStats ¶
func NewNodeStats() *NodeStats
func (*NodeStats) CalcIdleEnergy ¶
func (*NodeStats) ResetDeltaValues ¶
func (ne *NodeStats) ResetDeltaValues()
ResetDeltaValues reset all delta values to 0
func (*NodeStats) SetNodeOtherComponentsEnergy ¶
func (ne *NodeStats) 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 (*NodeStats) UpdateIdleEnergyWithMinValue ¶
type ProcessStats ¶
type ProcessStats struct { Stats PID uint64 CGroupID uint64 ContainerID string VMID string Command string IdleCounter int }
func NewProcessStats ¶
func NewProcessStats(pid, cGroupID uint64, containerID, vmID, command string) *ProcessStats
NewProcessStats creates a new ProcessStats instance
func (*ProcessStats) ResetDeltaValues ¶
func (p *ProcessStats) ResetDeltaValues()
ResetDeltaValues reset all delta values to 0
func (*ProcessStats) String ¶
func (p *ProcessStats) String() string
type Stats ¶
type Stats struct { ResourceUsage map[string]*types.UInt64StatCollection EnergyUsage map[string]*types.UInt64StatCollection }
func (*Stats) CalcDynEnergy ¶
CalcDynEnergy calculate the difference between the absolute and idle energy/power
func (*Stats) ResetDeltaValues ¶
func (m *Stats) ResetDeltaValues()
ResetDeltaValues reset all current value to 0
func (*Stats) ToEstimatorValues ¶
ToEstimatorValues return values regarding metricNames. The metrics can be related to resource utilization or power consumption. Since Kepler collects metrics at intervals of SamplePeriodSec, which is greater than 1 second, and the power models are trained to estimate power in 1 second interval, it is necessary to normalize the resource utilization by the SamplePeriodSec. Note that this is important because the power curve can be different for higher or lower resource usage within 1 second interval.
func (*Stats) UpdateDynEnergy ¶
func (m *Stats) UpdateDynEnergy()
UpdateDynEnergy calculates the dynamic energy