stats

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CpuTotalTicks added in v1.5.8

func CpuTotalTicks() uint64

CpuTotalTicks calculates the total MHz available across all cores.

Where asymetric cores are correctly detected, the total ticks is the sum of the performance across both core types.

Where asymetric cores are not correctly detected (such as Intel 13th gen), the total ticks available is over-estimated, as we assume all cores are P cores.

func RuntimeStats added in v0.8.0

func RuntimeStats() map[string]string

RuntimeStats is used to return various runtime information

func SetCpuTotalTicks added in v1.5.8

func SetCpuTotalTicks(newCpuTotalTicks uint64)

Set the total ticks available across all cores.

Types

type CpuStats added in v1.5.8

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

CpuStats calculates cpu usage percentage

func NewCpuStats added in v1.5.8

func NewCpuStats() *CpuStats

NewCpuStats returns a cpu stats calculator

func (*CpuStats) Percent added in v1.5.8

func (c *CpuStats) Percent(cpuTime float64) float64

Percent calculates the cpu usage percentage based on the current cpu usage and the previous cpu usage where usage is given as time in nanoseconds spend in the cpu

func (*CpuStats) TicksConsumed added in v1.5.8

func (c *CpuStats) TicksConsumed(percent float64) float64

TicksConsumed calculates the total ticks consumes by the process across all cpu cores

Jump to

Keyboard shortcuts

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