cpu

package
v5.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cpu collects CPU metrics from the host OS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(base mb.BaseMetricSet) (mb.MetricSet, error)

New is a mb.MetricSetFactory that returns a cpu.MetricSet.

Types

type CPU

type CPU struct {
	CpuPerCore       bool
	LastCpuTimes     *CpuTimes
	LastCpuTimesList []CpuTimes
	CpuTicks         bool
}

func (*CPU) AddCpuPercentage

func (cpu *CPU) AddCpuPercentage(t2 *CpuTimes)

func (*CPU) AddCpuPercentageList

func (cpu *CPU) AddCpuPercentageList(t2 []CpuTimes)

type CpuTimes

type CpuTimes struct {
	sigar.Cpu
	UserPercent    float64 `json:"user_p"`
	SystemPercent  float64 `json:"system_p"`
	IdlePercent    float64 `json:"idle_p"`
	IOwaitPercent  float64 `json:"iowait_p"`
	IrqPercent     float64 `json:"irq_p"`
	NicePercent    float64 `json:"nice_p"`
	SoftIrqPercent float64 `json:"softirq_p"`
	StealPercent   float64 `json:"steal_p"`
}

func GetCpuPercentage

func GetCpuPercentage(last *CpuTimes, current *CpuTimes) *CpuTimes

func GetCpuPercentageList

func GetCpuPercentageList(last, current []CpuTimes) []CpuTimes

func GetCpuTimes

func GetCpuTimes() (*CpuTimes, error)

func GetCpuTimesList

func GetCpuTimesList() ([]CpuTimes, error)

type MetricSet

type MetricSet struct {
	mb.BaseMetricSet
	// contains filtered or unexported fields
}

MetricSet for fetching system CPU metrics.

func (*MetricSet) Fetch

func (m *MetricSet) Fetch() (common.MapStr, error)

Fetch fetches CPU metrics from the OS.

Jump to

Keyboard shortcuts

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