stats

package
v1.6.108 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUMHzPerCore added in v1.6.105

func CPUMHzPerCore() (uint64, uint64)

CPUMHzPerCore returns the MHz per CPU (P, E) core type.

As with CPUNumCores, asymetric core detection currently only works with Apple Silicon CPUs.

func CPUModelName added in v1.6.105

func CPUModelName() string

CPUModelName returns the model name of the CPU.

func CPUNumCores added in v1.6.105

func CPUNumCores() (int, int)

CPUNumCores returns the number of CPU cores available.

This is represented with two values - (Power (P), Efficiency (E)) so we can correctly compute total compute for processors with asymetric cores such as Apple Silicon.

For platforms with symetric cores (or where we do not correcly detect asymetric cores), all cores are presented as P cores.

func Init added in v1.6.105

func Init(configCpuTotalCompute uint64) error

Types

type CPUStats

type CPUStats struct {
	CPU          string
	User         float64
	System       float64
	Idle         float64
	TotalPercent float64
	TotalTicks   float64
}

CPUStats represents stats related to cpu usage

type DeviceGroupStats added in v0.9.0

type DeviceGroupStats = device.DeviceGroupStats

DeviceGroupStats represents stats related to device group

type DeviceStatsCollector added in v0.9.0

type DeviceStatsCollector func() []*DeviceGroupStats

DeviceStatsCollector is used to retrieve all the latest statistics for all devices.

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
	AllocDirStats    *DiskStats
	DeviceStats      []*DeviceGroupStats
	Uptime           uint64
	Timestamp        int64
	CPUTicksConsumed float64
}

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(logger hclog.Logger, allocDir string, deviceStatsCollector DeviceStatsCollector) *HostStatsCollector

NewHostStatsCollector returns a HostStatsCollector. The allocDir is passed in so that we can present the disk related statistics for the mountpoint where the allocation directory lives

func (*HostStatsCollector) Collect

func (h *HostStatsCollector) Collect() error

Collect collects stats related to resource usage of a host

func (*HostStatsCollector) Stats added in v0.5.2

func (h *HostStatsCollector) Stats() *HostStats

Stats returns the host stats that has been collected

type MemoryStats

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

MemoryStats represents stats related to virtual memory usage

type NodeStatsCollector added in v0.5.2

type NodeStatsCollector interface {
	Collect() error
	Stats() *HostStats
}

NodeStatsCollector is an interface which is used for the purposes of mocking the HostStatsCollector in the tests

Jump to

Keyboard shortcuts

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