cpu

package
v6.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NumCores is the number of CPU cores in the system. Changes to operating
	// system CPU allocation after process startup are not reflected.
	NumCores = runtime.NumCPU()
)

Functions

This section is empty.

Types

type CoreMetrics

type CoreMetrics Metrics

CoreMetrics is used to monitor the usage of individual CPU cores.

func (*CoreMetrics) Percentages

func (m *CoreMetrics) Percentages() Percentages

Percentages returns CPU percentage usage information for the core. The values range from [0, 100%].

func (*CoreMetrics) Ticks

func (m *CoreMetrics) Ticks() Ticks

Ticks returns the raw number of "ticks". The value is a counter (though it may roll overfunc (m *CoreMetrics) Ticks() Ticks { return (*Metrics)(m).Ticks() }

type CoresMonitor

type CoresMonitor struct {
	// contains filtered or unexported fields
}

CoresMonitor is used to monitor the usage information of all the CPU cores in the system.

func (*CoresMonitor) Sample

func (m *CoresMonitor) Sample() ([]CoreMetrics, error)

Sample collects a new sample of the metrics from all CPU cores.

type LoadAverages

type LoadAverages struct {
	OneMinute     float64
	FiveMinute    float64
	FifteenMinute float64
}

LoadAverages stores the values of load averages of the last 1, 5 and 15 minutes.

type LoadMetrics

type LoadMetrics struct {
	// contains filtered or unexported fields
}

LoadMetrics stores the sampled load average values of the host.

func Load

func Load() (*LoadMetrics, error)

Load returns CPU load information for the previous 1, 5, and 15 minute periods.

func (*LoadMetrics) Averages

func (m *LoadMetrics) Averages() LoadAverages

Averages return the CPU load averages. These values should range from 0 to NumCores.

func (*LoadMetrics) NormalizedAverages

func (m *LoadMetrics) NormalizedAverages() LoadAverages

NormalizedAverages return the CPU load averages normalized by the NumCores. These values should range from 0 to 1.

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics stores the current and the last sample collected by a Beat.

func (*Metrics) NormalizedPercentages

func (m *Metrics) NormalizedPercentages() Percentages

NormalizedPercentages returns CPU percentage usage information that is normalized by the number of CPU cores (NumCores). The values will range from 0 to 100%.

func (*Metrics) Percentages

func (m *Metrics) Percentages() Percentages

Percentages returns CPU percentage usage information. The values range from 0 to 100% * NumCores.

func (*Metrics) Ticks

func (m *Metrics) Ticks() Ticks

Ticks returns the number of CPU ticks from the last collected sample.

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor is used to monitor the overal CPU usage of the system.

func (*Monitor) Sample

func (m *Monitor) Sample() (*Metrics, error)

Sample collects a new sample of the CPU usage metrics.

type Percentages

type Percentages struct {
	User    float64
	System  float64
	Idle    float64
	IOWait  float64
	IRQ     float64
	Nice    float64
	SoftIRQ float64
	Steal   float64
	Total   float64
}

Percentages stores all CPU values in percentages collected by a Beat.

type Ticks

type Ticks struct {
	User    uint64
	System  uint64
	Idle    uint64
	IOWait  uint64
	IRQ     uint64
	Nice    uint64
	SoftIRQ uint64
	Steal   uint64
}

Ticks stores all CPU values in number of tick collected by a Beat.

Jump to

Keyboard shortcuts

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