ucal

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeStatNotFound = errors.New("cannot find TimesStat for cpu")

Functions

This section is empty.

Types

type CPUUtilization

type CPUUtilization struct {
	CPU     string
	User    float64
	System  float64
	Idle    float64
	Nice    float64
	Iowait  float64
	Irq     float64
	Softirq float64
	Steal   float64
}

CPUUtilization stores the utilization percents [0-1] for the different cpu states

type CPUUtilizationCalculator

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

CPUUtilizationCalculator calculates the cpu utilization percents for the different cpu states It requires 2 []cpu.TimesStat and spend time to be able to calculate the difference

func (*CPUUtilizationCalculator) CalculateAndRecord

func (c *CPUUtilizationCalculator) CalculateAndRecord(now pcommon.Timestamp, cpuTimes []cpu.TimesStat, recorder func(pcommon.Timestamp, CPUUtilization)) error

CalculateAndRecord calculates the cpu utilization for the different cpu states comparing previously stored []cpu.TimesStat and time.Time and current []cpu.TimesStat and current time.Time If no previous data is stored it will return empty slice of CPUUtilization and no error

Jump to

Keyboard shortcuts

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