stats

package
v0.4.0-5 Latest Latest
Warning

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

Go to latest
Published: May 31, 2016 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	CPU    string
	User   float64
	System float64
	Idle   float64
	Total  float64
}

CPUStats represents stats related to cpu usage

type CpuStats

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

CpuStats calculates cpu usage percentage

func NewCpuStats

func NewCpuStats() *CpuStats

NewCpuStats returns a cpu stats calculator

func (*CpuStats) Percent

func (c *CpuStats) Percent(currentProcessUsage float64) float64

Percent calculates the cpu usage percentage based on the current cpu usage and the previous cpu usage

type DiskStats

type DiskStats struct {
	Device            string
	Mountpoint        string
	Size              uint64
	Used              uint64
	Available         uint64
	UsedPercent       float64
	InodesUsedPercent float64
}

DiskStats represents stats related to disk usage

type HostCpuStatsCalculator

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

HostCpuStatsCalculator calculates cpu usage percentages

func NewHostCpuStatsCalculator

func NewHostCpuStatsCalculator() *HostCpuStatsCalculator

NewHostCpuStatsCalculator returns a HostCpuStatsCalculator

func (*HostCpuStatsCalculator) Calculate

func (h *HostCpuStatsCalculator) Calculate(times cpu.TimesStat) (idle float64, user float64, system float64, total float64)

Calculate calculates the current cpu usage percentages

type HostStats

type HostStats struct {
	Memory    *MemoryStats
	CPU       []*CPUStats
	DiskStats []*DiskStats
	Uptime    uint64
	Timestamp int64
}

HostStats represents resource usage stats of the host running a Nomad client

type HostStatsCollector

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

HostStatsCollector collects host resource usage stats

func NewHostStatsCollector

func NewHostStatsCollector() *HostStatsCollector

NewHostStatsCollector returns a HostStatsCollector

func (*HostStatsCollector) Collect

func (h *HostStatsCollector) Collect() (*HostStats, error)

Collect collects stats related to resource usage of a host

type MemoryStats

type MemoryStats struct {
	Total     uint64
	Available uint64
	Used      uint64
	Free      uint64
}

MemoryStats represnts stats related to virtual memory usage

type RingBuff

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

RingBuff is a data structure which is a circular list based on slices

func NewRingBuff

func NewRingBuff(capacity int) (*RingBuff, error)

NewRingBuff creates a new ring buffer of the specified size

func (*RingBuff) Enqueue

func (r *RingBuff) Enqueue(value interface{})

Enqueue queues a new value in the ring buffer. This operation would over-write an older value if the list has reached it's capacity

func (*RingBuff) Peek

func (r *RingBuff) Peek() interface{}

Peek returns the last value enqueued in the ring buffer

func (*RingBuff) Values

func (r *RingBuff) Values() []interface{}

Values returns all the values in the buffer.

Jump to

Keyboard shortcuts

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