meminfo

package
Version: v0.0.0-...-acb5a1f Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Overview

Package meminfo provides an i3bar module that shows memory information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RefreshInterval

func RefreshInterval(interval time.Duration)

RefreshInterval configures the polling frequency.

Types

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.

Source Files

Jump to

Keyboard shortcuts

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