cpux

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

Documentation

Overview

Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g. cpu0, cpu1, etc. On linux systems this comes from the sysfs filesystem. Not all paths are available on all systems, e.g. /sys/devices/system/cpu/cpuX/cpufreq and its children may not exist on some systems. If the system doesn't have a particular path, the field's value will be the type's zero value. Instead of returning a Go struct, JSON serialized bytes are returned. A function to deserialize the JSON serialized bytes into a cpux.CPUs struct is provided.

Note: the package name is cpux 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) (*x.CPUs, error)

Deserialize takes some JSON serialized bytes and unmarshals them as cpux.CPUs.

func Get

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

Get returns the current cpux as JSON serialized bytes using the package's global Profiler.

func Marshal

func Marshal(cpus *x.CPUs) ([]byte, error)

Marshal is an alias for Serialize using package globals.

func Serialize

func Serialize(cpus *x.CPUs) (p []byte, err error)

Serialize cpux.CPUs as JSON using package globals.

func Unmarshal

func Unmarshal(p []byte) (*x.CPUs, error)

Unmarshal is an alias for Deserialize using package globals.

Types

type Profiler

type Profiler struct {
	*x.Profiler
}

Profiler is used to process the cpuX information.

func NewProfiler

func NewProfiler() *Profiler

Initializes and returns a cpuinfo profiler.

func (*Profiler) Get

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

Get returns the current cpuinfo as JSON serialized bytes.

func (*Profiler) Marshal

func (prof *Profiler) Marshal(cpus *x.CPUs) ([]byte, error)

Marshal is an alias for serialize.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(cpus *x.CPUs) ([]byte, error)

Serialize cpux.CPUs as JSON.

Jump to

Keyboard shortcuts

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