Documentation
¶
Overview ¶
Package stat provides for counting system and process cpu and memory information, alarm notification support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlarmOption ¶
type AlarmOption func(*alarmOptions)
AlarmOption set the alarm options field.
func WithCPUThreshold ¶
func WithCPUThreshold(threshold float64) AlarmOption
WithCPUThreshold set cpu threshold, range 0 to 1
func WithMemoryThreshold ¶
func WithMemoryThreshold(threshold float64) AlarmOption
WithMemoryThreshold set memory threshold, range 0 to 1
type Option ¶
type Option func(*options)
Option set the stat options field.
func WithAlarm ¶
func WithAlarm(opts ...AlarmOption) Option
WithAlarm enable alarm and notify, except windows
func WithCustomHandler ¶ added in v1.14.5
WithCustomHandler set custom handler and interval, will replace default print stat data handler
func WithPrintField ¶
WithPrintField set print field
func WithPrintInterval ¶
WithPrintInterval set print interval
type Process ¶ added in v1.14.5
type Process struct { CPUUsage float64 `json:"cpu_usage"` // process cpu usage, unit(%) RSS uint64 `json:"rss"` // use of physical memory, unit(M) VMS uint64 `json:"vms"` // use of virtual memory, unit(M) Alloc uint64 `json:"alloc"` // allocated memory capacity, unit(M) TotalAlloc uint64 `json:"total_alloc"` // cumulative allocated memory capacity, unit(M) Sys uint64 `json:"sys"` // requesting memory capacity from the system, unit(M) NumGc uint32 `json:"num_gc"` // number of GC cycles Goroutines int `json:"goroutines"` // number of goroutines }
Process information
type System ¶ added in v1.14.5
type System struct { CPUUsage float64 `json:"cpu_usage"` // system cpu usage, unit(%) MemUsage float64 `json:"mem_usage"` // system memory usage, unit(%) CPUCores int32 `json:"cpu_cores"` // cpu cores, multiple cpu accumulation MemTotal uint64 `json:"mem_total"` // system total physical memory, unit(M) MemFree uint64 `json:"mem_free"` // system free physical memory, unit(M) }
System information
Directories
¶
Path | Synopsis |
---|---|
Package cpu is a library that counts system and process cpu usage.
|
Package cpu is a library that counts system and process cpu usage. |
Package mem is a library that counts system and process memory usage.
|
Package mem is a library that counts system and process memory usage. |
Click to show internal directories.
Click to hide internal directories.