cpu

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	User      uint64 `json:"user"`
	Nice      uint64 `json:"nice"`
	System    uint64 `json:"system"`
	Idle      uint64 `json:"idle"`
	Iowait    uint64 `json:"iowait"`
	Irq       uint64 `json:"irq"`
	Softirq   uint64 `json:"softirq"`
	Steal     uint64 `json:"steal"`
	Guest     uint64 `json:"guest"`
	GuestNice uint64 `json:"guestnice"`
	Total     uint64 `json:"total"`
}

CPUStats represents cpu statistics for linux

func GetCPUStats

func GetCPUStats() (cpu CPUStats, err error)

GetCPUStats get cpu statistics

func (*CPUStats) CPUUsage

func (cs *CPUStats) CPUUsage() float64

func (*CPUStats) GuestNiceUsage

func (cs *CPUStats) GuestNiceUsage() float64

func (*CPUStats) GuestUsage

func (cs *CPUStats) GuestUsage() float64

func (*CPUStats) IdleUsage

func (cs *CPUStats) IdleUsage() float64

func (*CPUStats) IowaitUsage

func (cs *CPUStats) IowaitUsage() float64

func (*CPUStats) IrqUsage

func (cs *CPUStats) IrqUsage() float64

func (*CPUStats) NiceUsage

func (cs *CPUStats) NiceUsage() float64

func (*CPUStats) SoftirqUsage

func (cs *CPUStats) SoftirqUsage() float64

func (*CPUStats) StealUsage

func (cs *CPUStats) StealUsage() float64

func (*CPUStats) String

func (cs *CPUStats) String() string

func (*CPUStats) Subtract

func (cs *CPUStats) Subtract(s *CPUStats)

func (*CPUStats) SystemUsage

func (cs *CPUStats) SystemUsage() float64

func (*CPUStats) UserUsage

func (cs *CPUStats) UserUsage() float64

type CPUUsage

type CPUUsage struct {
	CPUStats
	Delta time.Duration `json:"delta,omitempty"`
}

func GetCPUUsage

func GetCPUUsage(delta time.Duration) (cu CPUUsage, err error)

GetCPUUsage get cpu usage between delta duration

Jump to

Keyboard shortcuts

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