Documentation ¶
Overview ¶
Package cpustats handles JSON 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 JSON serialized bytes. A function to deserialize the JSON serialized bytes into a cpustats.CPUStats struct is provided.
Note: the package name is cpustats and not the final element of the import path (json).
Index ¶
- func Deserialize(p []byte) (*stats.CPUStats, error)
- func Get() (p []byte, err error)
- func Marshal(st *stats.CPUStats) ([]byte, error)
- func NewTicker(d time.Duration) (joe.Tocker, error)
- func Serialize(st *stats.CPUStats) (p []byte, err error)
- func Unmarshal(p []byte) (*stats.CPUStats, error)
- type Profiler
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
Deserialize takes some JSON serialized bytes and unmarshals them as cpustats.Stats
func Get ¶
Get returns information about current kernel activity as JSON serialized bytes using the package's global Profiler.
func NewTicker ¶
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.
Types ¶
type Profiler ¶
Profiler is used to process the /proc/stats file as JSON serialized bytes.
func NewProfiler ¶
Returns an initialized profiler that uses JSON.
func (*Profiler) Get ¶
Get returns information about current kernel activity as JSON serialized bytes.