Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is used to monitor the overal CPU usage of the system.