Help us shape the future of Go! Take the 2026 Go Developer Survey

resources

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bandwidth

func Bandwidth(mhz uint64) (uint64, error)

Bandwidth computes the CPU bandwidth given a mhz value from task config. We assume the bandwidth per-core base is 100_000 which is the default.

Types

type MicroSecond

type MicroSecond uint64

type Percent

type Percent float64

type Specs

type Specs struct {
	MHz   int
	Cores int
}

func GetSpecs

func GetSpecs() *Specs

GetSpecs returns the MHz and Cores of the detected CPU.

Tries to read accurate information out of /sys/devices before falling back to /proc/cpuinfo.

TODO(shoenig): we should probably get this from the Topology plumbed into the driver - which did not exist for the pledge driver when this code was originally written.

func (*Specs) Ticks

func (s *Specs) Ticks() int

type TrackCPU

type TrackCPU struct {
	// contains filtered or unexported fields
}

func (*TrackCPU) Percent

func (t *TrackCPU) Percent(user, system, total MicroSecond) (Percent, Percent, Percent)

Percent returns the percentage of time spent in user, system, total CPU usage.

type Utilization

type Utilization struct {
	Memory uint64
	Swap   uint64
	Cache  uint64

	System          Percent
	User            Percent
	Percent         Percent
	ThrottlePeriods uint64
	ThrottleTime    uint64
	Ticks           Percent
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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