cpuinfo

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 cpuinfo (json) handles JSON based processing of /proc/cpuinfo. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into a cpuinfo.CPUInfo struct is provided.

Note: the package name is cpuinfo 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) (*info.CPUInfo, error)

Deserialize takes some JSON serialized bytes and unmarshals them as cpuinfo.CPUInfo.

func Get

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

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

func Marshal

func Marshal(inf *info.CPUInfo) ([]byte, error)

Marshal is an alias for Serialize using package globals.

func Serialize

func Serialize(inf *info.CPUInfo) (p []byte, err error)

Serialize cpuinfo as JSON using package globals.

func Unmarshal

func Unmarshal(p []byte) (*info.CPUInfo, error)

Unmarshal is an alias for Deserialize using package globals.

Types

type Profiler

type Profiler struct {
	*info.Profiler
}

Profiler is used to process the /proc/cpuinfo file as JSON serialized bytes.

func NewProfiler

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

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(inf *info.CPUInfo) ([]byte, error)

Marshal is an alias for serialize.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(inf *info.CPUInfo) ([]byte, error)

Serialize cpuinfo as JSON.

Jump to

Keyboard shortcuts

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