meminfo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package meminfo gets the system's memory information, /proc/meminfo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTicker

func NewTicker(d time.Duration) (joe.Tocker, error)

NewTicker returns a new Ticker containing a Data channel that delivers the data at intervals and an error channel that delivers any errors encountered. Stop the ticker to signal the ticker to stop running. Stopping the ticker does not close the Data channel; call Close to close both the ticker and the data channel.

Types

type Info

type Info struct {
	Timestamp         int64  `json:"timestamp"`
	Active            uint64 `json:"active"`
	ActiveAnon        uint64 `json:"active_anon"`
	ActiveFile        uint64 `json:"active_file"`
	AnonHugePages     uint64 `json:"anon_huge_pages"`
	AnonPages         uint64 `json:"anon_pages"`
	Bounce            uint64 `json:"bounce"`
	Buffers           uint64 `json:"buffers"`
	Cached            uint64 `json:"cached"`
	CommitLimit       uint64 `json:"commit_limit"`
	CommittedAS       uint64 `json:"commited_as"`
	DirectMap4K       uint64 `json:"direct_map_4k"`
	DirectMap2M       uint64 `json:"direct_map_2m"`
	Dirty             uint64 `json:"dirty"`
	HardwareCorrupted uint64 `json:"hardware_corrupted"`
	HugePagesFree     uint64 `json:"huge_pages_free"`
	HugePagesRsvd     uint64 `json:"huge_pages_rsvd"`
	HugePagesSize     uint64 `json:"huge_pages_size"`
	HugePagesSurp     uint64 `json:"huge_pages_surp"`
	HugePagesTotal    uint64 `json:"huge_pages_total"`
	Inactive          uint64 `json:"inactive"`
	InactiveAnon      uint64 `json:"inactive_anon"`
	InactiveFile      uint64 `json:"inactive_file"`
	KernelStack       uint64 `json:"kernel_stack"`
	Mapped            uint64 `json:"mapped"`
	MemAvailable      uint64 `json:"mem_available"`
	MemFree           uint64 `json:"mem_free"`
	MemTotal          uint64 `json:"mem_total"`
	Mlocked           uint64 `json:"mlocked"`
	NFSUnstable       uint64 `json:"nfs_unstable"`
	PageTables        uint64 `json:"page_tables"`
	Shmem             uint64 `json:"shmem"`
	Slab              uint64 `json:"slab"`
	SReclaimable      uint64 `json:"s_reclaimable"`
	SUnreclaim        uint64 `json:"s_unreclaim"`
	SwapCached        uint64 `json:"swap_cached"`
	SwapFree          uint64 `json:"swap_free"`
	SwapTotal         uint64 `json:"swap_total"`
	Unevictable       uint64 `json:"unevictable"`
	VmallocChunk      uint64 `json:"vmalloc_chunk"`
	VmallocTotal      uint64 `json:"vmalloc_total"`
	VmallocUsed       uint64 `json:"vmalloc_used"`
	Writeback         uint64 `json:"writeback"`
	WritebackTmp      uint64 `json:"writeback_tmp"`
}

Info holds the memory information.

func Get

func Get() (inf *Info, err error)

Get returns the current memory information using the package's global Profiler.

type Profiler

type Profiler struct {
	joe.Procer
	*joe.Buffer
}

Profiler is used to get the memory information by processing the /proc/meminfo file.

func NewProfiler

func NewProfiler() (prof *Profiler, err error)

Returns an initialized Profiler; ready to use.

func (*Profiler) Get

func (prof *Profiler) Get() (inf *Info, err error)

Get returns the current memory information.

func (*Profiler) Reset

func (prof *Profiler) Reset() error

Reset resources: after reset, the profiler is ready to be used again.

type Ticker

type Ticker struct {
	*joe.Ticker
	Data chan Info
	*Profiler
}

Ticker delivers the system's memory information at intervals.

func (*Ticker) Close

func (t *Ticker) Close()

Close closes the ticker resources.

func (*Ticker) Run

func (t *Ticker) Run()

Run runs the ticker.

Directories

Path Synopsis
Package meminfo processes a subset of the /proc/meminfo file.
Package meminfo processes a subset of the /proc/meminfo file.
Package meminfo processes the memory information, /proc/meminfo.
Package meminfo processes the memory information, /proc/meminfo.

Jump to

Keyboard shortcuts

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