mem

package
v0.0.0-...-32d6bb7 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linux

type Linux struct{}

Linux implements the Mem interface for Linux.

func NewLinuxProvider

func NewLinuxProvider() *Linux

NewLinuxProvider factory to create a new Linux instance.

func (*Linux) GetStats

func (l *Linux) GetStats() (*Stats, error)

GetStats retrieves memory statistics of the system. It returns a Stats struct with total, free, and cached memory in bytes, and an error if something goes wrong.

type Provider

type Provider interface {
	// GetStats retrieves memory statistics of the system.
	GetStats() (*Stats, error)
}

Provider implements the methods to interact with various Mem components.

type Stats

type Stats struct {
	// Total memory in bytes
	Total uint64
	// Free memory in bytes
	Free uint64
	// Cached memory in bytes
	Cached uint64
}

Stats holds memory information in bytes.

type Ubuntu

type Ubuntu struct {
	VirtualMemoryFn func() (*mem.VirtualMemoryStat, error)
}

Ubuntu implements the Mem interface for Ubuntu.

func NewUbuntuProvider

func NewUbuntuProvider() *Ubuntu

NewUbuntuProvider factory to create a new Ubuntu instance.

func (*Ubuntu) GetStats

func (u *Ubuntu) GetStats() (*Stats, error)

GetStats retrieves memory statistics of the system. It returns a Stats struct with total, free, and cached memory in bytes, and an error if something goes wrong.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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