processors

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

Documentation

Overview

Package processors gathers information about the physical processors on a system by parsing the information from /procs/cpuinfo and the sysfs. This package gathers basic information about sockets, physical processors, etc. on the system. For multi-socket systems, it is assumed that all of the processors are the same. Instead of returning a Go struct, JSON serialized bytes are returned. A function to deserialize the JSON serialized bytes into a processors.Processors struct is provided.

CPUMHz currently provides the current speed of the first core encountered for each physical processor. Modern x86/x86-64 cores have the ability to shift their speed so this is just a point in time data point for that core; there may be other cores on the processor that are at higher and lower speeds at the time the data is read. This field is more useful for other architectures. For x86/x86-64 cores, the MHzMin and MHzMax fields provide information about the range of speeds that are possible for the cores.

Note: the package name is processors 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) (*procs.Processors, error)

Deserialize takes some JSON serialized bytes and unmarshals them as processors.Processors

func Get

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

Get returns the processor information as JSON serialized bytes using the package's global Profiler.

func Marshal

func Marshal(proc *procs.Processors) ([]byte, error)

Marshal is an alias for Serialize.

func Serialize

func Serialize(proc *procs.Processors) (p []byte, err error)

Serialize processor information.

func Unmarshal

func Unmarshal(p []byte) (*procs.Processors, error)

Unmarshal is an alias for Deserialize

Types

type Profiler

type Profiler struct {
	*procs.Profiler
}

Profiler is used to get the processor information, as JSON serialized bytes, by processing the /proc/cpuinfo file.

func NewProfiler

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

Returns an initialized Profiler; ready to use.

func (*Profiler) Get

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

Get returns the processor information as JSON serialized bytes.

func (*Profiler) Marshal

func (p *Profiler) Marshal(proc *procs.Processors) ([]byte, error)

Marshal is an alias for serialize.

func (*Profiler) Serialize

func (p *Profiler) Serialize(proc *procs.Processors) ([]byte, error)

Serialize processor information.

Jump to

Keyboard shortcuts

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