mem

package
v0.0.0-...-2d83fc9 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mem returns memory information using syscalls. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into a mem.MemInfo struct is provided.

Note: the package name is mem 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) (*m.MemInfo, error)

Deserialize takes some JSON serialized bytes and unmarshals them as mem.MemInfo.

func Get

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

Get returns the system's memory information as JSON serialized bytes.

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 Unmarshal

func Unmarshal(p []byte) (*m.MemInfo, error)

Unmarshal is an alias for Deserialize.

Types

type Ticker

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

Ticker delivers mem.MemInfo as JSON serialized bytes 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
y or Y : Canonical URL