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 ¶
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.
Types ¶
type Profiler ¶
Profiler is used to get the processor information, as JSON serialized bytes, by processing the /proc/cpuinfo file.
func NewProfiler ¶
Returns an initialized Profiler; ready to use.