membasic

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

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

Go to latest
Published: Apr 10, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package membasic processes a subset of the /proc/meminfo file. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into a membasic.Info struct is provided. For more detailed information about a system's memory, use the meminfo package.

Note: the package name is membasic and not the final element of the import path (json).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(p []byte) (*basic.Info, error)

Deserialize takes some JSON serialized bytes and unmarshals them as membasic.Info.

func Get

func Get() (p []byte, err error)

Get returns the current basic memory information as JSON serialized bytes using the package's global Profiler.

func Marshal

func Marshal(inf *basic.Info) ([]byte, error)

Marshal is an alias for Serialize that uses the package's global profiler.

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.

func Serialize

func Serialize(inf *basic.Info) (p []byte, err error)

Serialize the basic memory information using JSON with the package's global Profiler.

func Unmarshal

func Unmarshal(p []byte) (*basic.Info, error)

Unmarshal is an alias for Deserialize.

Types

type Profiler

type Profiler struct {
	*basic.Profiler
}

Profiler is used to get the basic memory information, as JSON, 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() (p []byte, err error)

Get returns the current basic memory information as JSON serialized bytes.

func (*Profiler) Marshal

func (prof *Profiler) Marshal(inf *basic.Info) ([]byte, error)

Marshal is an alias for Serialize.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(inf *basic.Info) ([]byte, error)

Serialize the basic memory information using JSON.

type Ticker

type Ticker struct {
	*joe.Ticker
	Data chan []byte
	*Profiler
}

Ticker delivers the system's basic 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL