memory

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMeminfo

func ParseMeminfo(rootfs resolve.Resolver) (map[string]uint64, error)

ParseMeminfo parses the contents of /proc/meminfo into a hashmap

Types

type ActualMemoryMetrics

type ActualMemoryMetrics struct {
	Free opt.Uint     `struct:"free,omitempty"`
	Used UsedMemStats `struct:"used,omitempty"`
}

ActualMemoryMetrics wraps the actual.* memory metrics

type Memory

type Memory struct {
	Total opt.Uint     `struct:"total,omitempty"`
	Used  UsedMemStats `struct:"used,omitempty"`

	Free   opt.Uint `struct:"free,omitempty"`
	Cached opt.Uint `struct:"cached,omitempty"`
	// "Actual" values are, technically, a linux-only concept
	// For better or worse we've expanded it to include "derived"
	// Memory values on other platforms, which we should
	// probably keep for the sake of backwards compatibility
	// However, because the derived value varies from platform to platform,
	// We may want to more precisely document what these mean.
	Actual ActualMemoryMetrics `struct:"actual,omitempty"`

	// Swap metrics
	Swap SwapMetrics `struct:"swap,omitempty"`
}

Memory holds os-specifc memory usage data The vast majority of these values are cross-platform However, we're wrapping all them for the sake of safety, and for the more variable swap metrics

func Get

func Get(procfs resolve.Resolver) (Memory, error)

Get returns platform-independent memory metrics.

type SwapMetrics

type SwapMetrics struct {
	Total opt.Uint     `struct:"total,omitempty"`
	Used  UsedMemStats `struct:"used,omitempty"`
	Free  opt.Uint     `struct:"free,omitempty"`
}

SwapMetrics wraps swap.* memory metrics

func (SwapMetrics) IsZero

func (swap SwapMetrics) IsZero() bool

IsZero implements the zeroer interface for structform's folders

type UsedMemStats

type UsedMemStats struct {
	Pct   opt.Float `struct:"pct,omitempty"`
	Bytes opt.Uint  `struct:"bytes,omitempty"`
}

UsedMemStats wraps used.* memory metrics

func (UsedMemStats) IsZero

func (used UsedMemStats) IsZero() bool

IsZero implements the zeroer interface for structform's folders

Jump to

Keyboard shortcuts

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