cpufreq

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

Documentation

Overview

Package cpufreq provides the current CPU frequency, in MHz, as reported by /proc/cpuinfo. Instead of returning a Go struct, it returns Flatbuffer serialized bytes. A function to deserialize the Flatbuffer serialized bytes into a cpufreq.Frequency struct is provided.

Note: the package name is cpufreq 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) *freq.Frequency

Deserialize takes some Flatbuffer serialized bytes and deserializes them as cpufreq.Frequency.

func Get

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

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

func NewTicker

func NewTicker(d time.Duration) (joe.Tocker, error)

NewTicker returns a new Ticker containing a Data channel that delivers the data at intervals and an error channel that delivers any errors encountered. Stop the ticker to signal the ticker to stop running. Stopping the ticker does not close the Data channel; call Close to close both the ticker and the data channel.

func Serialize

func Serialize(f *freq.Frequency) (p []byte, err error)

Serialize cpufreq.Frequency using the package global profiler.

Types

type Profiler

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

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

func NewProfiler

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

Initializes and returns a cpuinfo profiler.

func (*Profiler) Get

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

Get returns the Frequency as Flatbuffer serialized bytes.

func (*Profiler) Serialize

func (p *Profiler) Serialize(f *freq.Frequency) []byte

Serialize serializes Frequency using Flatbuffers.

func (*Profiler) SerializeCPU

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

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

type Ticker

type Ticker struct {
	*joe.Ticker
	Data chan []byte
	*Profiler
}

Ticker delivers the CPU Frequencies at intervals.

func (*Ticker) Close

func (t *Ticker) Close()

Close closes the ticker resources.

func (*Ticker) Run

func (t *Ticker) Run()

Run runs the ticker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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