load

package
v0.0.0-...-36c55c0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package load provides system load average statistics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Darwin

type Darwin struct {
	provider.FactsAware

	AvgFn func() (*load.AvgStat, error)
}

Darwin implements the Load interface for Darwin (macOS).

func NewDarwinProvider

func NewDarwinProvider() *Darwin

NewDarwinProvider factory to create a new Darwin instance.

func (*Darwin) GetAverageStats

func (d *Darwin) GetAverageStats() (*Result, error)

GetAverageStats returns the system's load averages over 1, 5, and 15 minutes. It returns a AverageStats struct with load over 1, 5, and 15 minutes, and an error if something goes wrong.

type Debian

type Debian struct {
	provider.FactsAware

	AvgFn func() (*load.AvgStat, error)
}

Debian implements the Mem interface for Debian.

func NewDebianProvider

func NewDebianProvider() *Debian

NewDebianProvider factory to create a new Debian instance.

func (*Debian) GetAverageStats

func (u *Debian) GetAverageStats() (*Result, error)

GetAverageStats returns the system's load averages over 1, 5, and 15 minutes. It returns a AverageStats struct with load over 1, 5, and 15 minutes, and an error if something goes wrong.

type Linux

type Linux struct {
	provider.FactsAware
}

Linux implements the Load interface for Linux.

func NewLinuxProvider

func NewLinuxProvider() *Linux

NewLinuxProvider factory to create a new Linux instance.

func (*Linux) GetAverageStats

func (l *Linux) GetAverageStats() (*Result, error)

GetAverageStats returns the system's load averages over 1, 5, and 15 minutes. It returns a AverageStats struct with load over 1, 5, and 15 minutes, and an error if something goes wrong.

type Provider

type Provider interface {
	// GetAverageStats retrieves the system load averages.
	GetAverageStats() (*Result, error)
}

Provider implements the methods to interact with various Load components.

type Result

type Result struct {
	// Load average over the last 1 minute
	Load1 float32
	// Load average over the last 5 minutes
	Load5 float32
	// Load average over the last 15 minutes
	Load15 float32
	// Changed indicates whether system state was modified.
	Changed bool `json:"changed"`
}

Result represents the system load averages over 1, 5, and 15 minutes.

Directories

Path Synopsis
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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