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
Click to show internal directories.
Click to hide internal directories.