processors

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 5 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, Flatbuffer serialized bytes are returned. A function to deserialize the Flatbuffer 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 (flat).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(p []byte) *processors.Processors

Deserialize takes some Flatbuffer serialized bytes and deserializes them as processors.Processors.

func Get

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

Get returns the current processor info as Flatbuffer serialized bytes using the package's global Profiler.

func Serialize

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

Serialize processors information.

Types

type Profiler

type Profiler struct {
	*processors.Profiler
	*fb.Builder
}

Profiler is used to get the processor information, as Flatbuffers 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() ([]byte, error)

Get returns the processor information as Flatbuffer serialized bytes.

func (*Profiler) Serialize

func (p *Profiler) Serialize(procs *processors.Processors) []byte

Serialize serializes Processors using Flatbuffers.

func (*Profiler) SerializeCache

func (p *Profiler) SerializeCache(id, inf string) fb.UOffsetT

SerializeCache serializes a cache entry using flatbuffers and returns the resulting UOffsetT.

func (*Profiler) SerializeNumaNodeCPUs

func (p *Profiler) SerializeNumaNodeCPUs(n *node.Node) fb.UOffsetT

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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