stats

package
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MockedSocketID = "socket0"
)

Variables

This section is empty.

Functions

func CreateMockedProcessStats

func CreateMockedProcessStats(numContainers int) map[uint64]*ProcessStats

CreateMockedProcessStats adds two containers with all metrics initialized

func GetProcessFeatureNames added in v0.7.11

func GetProcessFeatureNames(bpfSupportedMetrics bpf.SupportedMetrics) []string

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 ContainerStats

type ContainerStats struct {
	Stats

	PIDS          map[uint64]bool
	ContainerID   string
	ContainerName string
	PodName       string
	Namespace     string
}

func NewContainerStats

func NewContainerStats(containerName, podName, podNamespace, containerID string, bpfSupportedMetrics bpf.SupportedMetrics) *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

type NodeStats

type NodeStats struct {
	Stats

	// IdleResUtilization is used to determine idle pmap[string]eriods
	IdleResUtilization map[string]uint64
	// contains filtered or unexported fields
}

func CreateMockedNodeStats

func CreateMockedNodeStats() NodeStats

CreateMockedNodeStats creates a node metric with power consumption and add the process resource utilization

func NewNodeStats

func NewNodeStats(bpfSupportedMetrics bpf.SupportedMetrics) *NodeStats

func (*NodeStats) CPUArchitecture added in v0.7.12

func (ne *NodeStats) CPUArchitecture() string

func (*NodeStats) CalcIdleEnergy

func (ne *NodeStats) CalcIdleEnergy(absM, idleM, resouceUtil string)

func (*NodeStats) MetadataFeatureNames added in v0.7.12

func (ne *NodeStats) MetadataFeatureNames() []string

func (*NodeStats) MetadataFeatureValues added in v0.7.12

func (ne *NodeStats) MetadataFeatureValues() []string

func (*NodeStats) NodeName added in v0.7.12

func (ne *NodeStats) NodeName() 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 latest 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, bpfSupportedMetrics bpf.SupportedMetrics) *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
	// contains filtered or unexported fields
}

Stats stores resource and energy usage statistics.

func NewStats

func NewStats(bpfSupportedMetrics bpf.SupportedMetrics) *Stats

NewStats creates a new Stats instance

func (*Stats) AbsEnergyMetrics added in v0.7.12

func (s *Stats) AbsEnergyMetrics() []string

func (*Stats) BPFMetrics added in v0.7.12

func (s *Stats) BPFMetrics() []string

func (*Stats) CalcDynEnergy

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

CalcDynEnergy calculates the difference between the absolute and idle energy/power.

func (*Stats) DynEnergyMetrics added in v0.7.12

func (s *Stats) DynEnergyMetrics() []string

func (*Stats) IdleEnergyMetrics added in v0.7.12

func (s *Stats) IdleEnergyMetrics() []string

func (*Stats) ResetDeltaValues

func (s *Stats) ResetDeltaValues()

ResetDeltaValues resets all current values to 0.

func (*Stats) String

func (s *Stats) String() string

func (*Stats) ToEstimatorValues

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

ToEstimatorValues returns values for the specified metric names, normalized if required. 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. This is important because the power curve can be different for higher or lower resource usage within 1 second interval.

func (*Stats) UpdateDynEnergy

func (s *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, bpfSupportedMetrics bpf.SupportedMetrics) *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