cpux

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: 4 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, Flatbuffer serialized bytes are returned. A function to deserialize the Flatbuffer serialized bytes into a cpux.CPU struct is provided.

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

Deserialize takes some Flatbuffer serialized bytes and deserializes them as cpux.CPUs.

func Get

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

Get returns the cpux information as Flatbuffer serialized bytes using the package's global profiler.

func Serialize

func Serialize(cpus *cpux.CPUs) (p []byte)

Serialize cpux.CPUs using the package global profiler.

Types

type Profiler

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

Profiler is used to process the cpux information as Flatbuffers serialized bytes.

func NewProfiler

func NewProfiler() *Profiler

Initializes and returns a cpux profiler.

func (*Profiler) Get

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

Get returns the cpux information as Flatbuffer serialized bytes.

func (*Profiler) Serialize

func (p *Profiler) Serialize(cpus *cpux.CPUs) []byte

Serialize serializes cpux.CPUs using Flatbuffers.

func (*Profiler) SerializeCPU

func (p *Profiler) SerializeCPU(cpu *cpux.CPU) fb.UOffsetT

SerializeCPU serializes a CPU using flatbuffers and returns the resulting UOffsetT.

func (*Profiler) SerializeCache

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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