cgcommon

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidFormat indicates a malformed key/value pair on a line.
	ErrInvalidFormat = errors.New("error invalid key/value format")
)

Functions

func GetPressure

func GetPressure(path string) (map[string]Pressure, error)

GetPressure takes the path of a *.pressure file and returns a map of the pressure (IO contention) stats for the cgroup on CPU controllers, the only key will be "some" on IO controllers, the keys will be "some" and "full" See https://github.com/torvalds/linux/blob/master/Documentation/accounting/psi.rst

func ParseCgroupParamKeyValue

func ParseCgroupParamKeyValue(t string) (string, uint64, error)

ParseCgroupParamKeyValue parses a cgroup param and returns the key name and value.

func ParseUint

func ParseUint(value []byte) (uint64, error)

ParseUint reads a single uint value. It will trip any whitespace before attempting to parse string. If the value is negative it will return 0.

func ParseUintFromFile

func ParseUintFromFile(path ...string) (uint64, error)

ParseUintFromFile reads a single uint value from a file.

Types

type CPUUsage

type CPUUsage struct {
	NS   uint64     `json:"ns" struct:"ns"`
	Pct  opt.Float  `json:"pct,omitempty" struct:"pct,omitempty"`
	Norm opt.PctOpt `json:"norm,omitempty" struct:"norm,omitempty"`
}

CPUUsage wraps the CPU usage time values for the CPU controller metrics

type Pressure

type Pressure struct {
	Ten          opt.Pct  `json:"10,omitempty" struct:"10,omitempty"`
	Sixty        opt.Pct  `json:"60,omitempty" struct:"60,omitempty"`
	ThreeHundred opt.Pct  `json:"300,omitempty" struct:"300,omitempty"`
	Total        opt.Uint `json:"total,omitempty" struct:"total,omitempty"`
}

Pressure contains load metrics for a controller, Broken apart into 10, 60, and 300 second samples, as well as a total time in US

func (Pressure) IsZero

func (p Pressure) IsZero() bool

IsZero implements the IsZero interface for Pressure This is "all or nothing", as pressure stats don't exist on certain systems If `total` doesn't exist, that means there's no pressure metrics.

Jump to

Keyboard shortcuts

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