v0.0.0-...-87682d9 Latest Latest

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 13



Package meminfo provides an i3bar module that shows memory information.



This section is empty.


This section is empty.


func RefreshInterval

func RefreshInterval(interval time.Duration)

RefreshInterval configures the polling frequency.


type Info

type Info map[string]unit.Datasize

Info wraps meminfo output. See /proc/meminfo for names of keys. Some common functions are also provided.

func (Info) AvailFrac

func (i Info) AvailFrac() float64

AvailFrac returns the available memory as a fraction of total.

func (Info) Available

func (i Info) Available() unit.Datasize

Available returns the "available" system memory, including currently cached memory that can be freed up if needed.

func (Info) FreeFrac

func (i Info) FreeFrac(k string) float64

FreeFrac returns a free/total metric for a given name, e.g. Mem, Swap, High, etc.

type Module

type Module struct {
	// contains filtered or unexported fields

Module represents a bar.Module that displays memory information.

func New

func New() *Module

New creates a new meminfo module.

func (*Module) Output

func (m *Module) Output(outputFunc func(Info) bar.Output) *Module

Output configures a module to display the output of a user-defined function.

func (*Module) Stream

func (m *Module) Stream(s bar.Sink)

Stream subscribes to meminfo and updates the module's output accordingly.

Jump to

Keyboard shortcuts

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