cpustats

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: 6 Imported by: 0

Documentation

Overview

Package cpustats handles Flatbuffer based processing of kernel activity, /proc/stat. The first Stats.CPU element aggregates the values for all other CPU elements. The values are aggregated since system boot. Instead of returning a Go struct, it returns Flatbuffer serialized bytes. A function to deserialize the Flatbuffer serialized bytes into a cpustats.CPUStats struct is provided.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(p []byte) *stats.CPUStats

Deserialize takes some Flatbuffer serialized bytes and deserializes them as cpustats.CPUStats.

func Get

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

Get returns information about current kernel activity as Flatbuffer serialized bytes using 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(stts *stats.CPUStats) (p []byte, err error)

Serialize cpustats.CPUStats with Flatbuffers using the package's global Profiler.

Types

type Profiler

type Profiler struct {
	*stats.Profiler
	*fb.Builder
}

Profiler is used to process the /proc/stats file as Flatbuffer serialized bytes.

func NewProfiler

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

Returns an initialized profiler that uses Flatbuffers.

func (*Profiler) Get

func (prof *Profiler) Get() ([]byte, error)

Get returns information about current kernel activity as Flatbuffer serialized bytes.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(stts *stats.CPUStats) []byte

Serialize cpustats.CPUStats using Flatbuffers.

type Ticker

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

Ticker delivers the system's kernel activity 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

Jump to

Keyboard shortcuts

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