Documentation
¶
Overview ¶
Package cpu collects CPU metrics from the host OS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NumCPU = runtime.NumCPU()
NumCPU is the number of CPU cores the system has.
Functions ¶
Types ¶
type CPU ¶
type CPU struct {
CpuPerCore bool
LastCpuTimes *CpuTimes
LastCpuTimesList []CpuTimes
CpuTicks bool
Cores int
}
func (*CPU) AddCpuPercentage ¶
func (cpu *CPU) AddCpuPercentage(t2 *CpuTimes)
func (*CPU) AddCpuPercentageList ¶
func (cpu *CPU) AddCpuPercentageList(t2 []CpuTimes)
type CpuTimes ¶
type CpuTimes struct {
sigar.Cpu
UserPercent float64 `json:"user_p"`
SystemPercent float64 `json:"system_p"`
IdlePercent float64 `json:"idle_p"`
IOwaitPercent float64 `json:"iowait_p"`
IrqPercent float64 `json:"irq_p"`
NicePercent float64 `json:"nice_p"`
SoftIrqPercent float64 `json:"softirq_p"`
StealPercent float64 `json:"steal_p"`
}
func GetCpuPercentage ¶
func GetCpuPercentage(last *CpuTimes, current *CpuTimes) *CpuTimes
func GetCpuPercentageList ¶
func GetCpuPercentageList(last, current []CpuTimes) []CpuTimes
func GetCpuTimes ¶
func GetCpuTimes() (*CpuTimes, error)
func GetCpuTimesList ¶
func GetCpuTimesList() ([]CpuTimes, error)
Click to show internal directories.
Click to hide internal directories.