Documentation
¶
Overview ¶
Package cpu tracks the combined usage of all CPUs (not per-CPU).
Index ¶
- Constants
- func Get(ctx context.Context) (_ any, e error)
- func HasBlockedTooLong(line string) bool
- func HasSoftLockup(line string) bool
- func Match(line string) (eventName string, message string)
- func New(ctx context.Context, cfg Config) (components.Component, error)
- type Config
- type Cores
- type Info
- type Output
- type Usage
Constants ¶
View Source
const ( StateNameInfo = "info" StateKeyInfoCPU = "cpu" StateKeyInfoArch = "arch" StateKeyInfoFamily = "family" StateKeyInfoModel = "model" StateKeyInfoModelName = "model_name" StateNameCores = "cores" StateKeyCoresPhysical = "physical" StateKeyCoresLogical = "logical" StateNameUsage = "usage" StateKeyUsageUsedPercent = "used_percent" StateKeyUsageLoadAvg1Min = "load_avg_1min" StateKeyUsageLoadAvg5Min = "load_avg_5min" StateKeyUsageLoadAvg15Min = "load_avg_15min" )
Variables ¶
This section is empty.
Functions ¶
func HasBlockedTooLong ¶ added in v0.4.4
Returns the task name and true if the line indicates that a task is hung too long.
func HasSoftLockup ¶ added in v0.4.4
Returns the task name and true if the line indicates a CPU soft lockup.
Types ¶
type Config ¶
type Config struct {
Query query_config.Config `json:"query"`
}
type Info ¶
type Output ¶
type Output struct { Info Info `json:"info"` Cores Cores `json:"cores"` Usage Usage `json:"usage"` }
func ParseOutputJSON ¶
func ParseStatesToOutput ¶
func ParseStatesToOutput(states ...components.State) (*Output, error)
type Usage ¶
type Usage struct { // Used CPU in percentage. UsedPercent string `json:"used_percent"` // Load average for the last 1-minute, with the scale of 1.00. LoadAvg1Min string `json:"load_avg_1min"` // Load average for the last 5-minutes, with the scale of 1.00. LoadAvg5Min string `json:"load_avg_5min"` // Load average for the last 15-minutes, with the scale of 1.00. LoadAvg15Min string `json:"load_avg_15min"` }
func (Usage) GetLoadAvg15Min ¶
func (Usage) GetLoadAvg1Min ¶
func (Usage) GetLoadAvg5Min ¶
func (Usage) GetUsedPercent ¶
Click to show internal directories.
Click to hide internal directories.