stats

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	MockedSocketID = "socket0"
)

Variables

View Source
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}
)
View Source
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
)
View Source
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
)
View Source
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 CPUModelData struct {
	Core     string `yaml:"core"`
	Uarch    string `yaml:"uarch"`
	Family   string `yaml:"family"`
	Model    string `yaml:"model"`
	Stepping string `yaml:"stepping"`
}

type CPUS

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

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 (ne *NodeStats) CalcIdleEnergy(absM, idleM, resouceUtil string)

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) String

func (ne *NodeStats) String() string

func (*NodeStats) UpdateIdleEnergyWithMinValue

func (ne *NodeStats) UpdateIdleEnergyWithMinValue(isComponentsSystemCollectionSupported bool)

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 NewStats

func NewStats() *Stats

NewStats creates a new Stats instance

func (*Stats) CalcDynEnergy

func (m *Stats) CalcDynEnergy(absM, idleM, dynM, id string)

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) String

func (m *Stats) String() string

func (*Stats) ToEstimatorValues

func (m *Stats) ToEstimatorValues(featuresName []string, shouldNormalize bool) []float64

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

type VMStats

type VMStats struct {
	Stats
	PID  uint64
	VMID string
}

func NewVMStats

func NewVMStats(pid uint64, vmID string) *VMStats

NewVMStats creates a new VMStats instance

func (*VMStats) ResetDeltaValues

func (vm *VMStats) ResetDeltaValues()

ResetCurr reset all current value to 0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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