machine

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: GPL-3.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentProcess

func GetCurrentProcess() (*process.Process, error)

GetCurrentProcess returns details about the current process

func NewNetStatistics

func NewNetStatistics() *netStatistics

NewNetStatistics returns a new instance of the netStatistics

Types

type CpuStatistics

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

CpuStatistics can compute the cpu usage percent

func NewCpuStatistics

func NewCpuStatistics() (*CpuStatistics, error)

NewCpuStatistics will create a CpuStatistics object

func (*CpuStatistics) ComputeStatistics

func (cs *CpuStatistics) ComputeStatistics()

ComputeStatistics computes the current cpu usage. It should be called on a go routine as it is a blocking call for a bounded time (1 second)

func (*CpuStatistics) CpuPercentUsage

func (cs *CpuStatistics) CpuPercentUsage() uint64

CpuPercentUsage will return the cpu percent usage. Concurrent safe.

type MemStatistics

type MemStatistics struct {
	Total        uint64
	PercentUsed  uint64
	UsedByGolang uint64
	UsedBySystem uint64
	HeapInUse    uint64
	StackInUse   uint64
}

MemStatistics holds memory statistics

func AcquireMemStatistics

func AcquireMemStatistics() MemStatistics

AcquireMemStatistics acquires memory statistics

func (*MemStatistics) String

func (stats *MemStatistics) String() string

Jump to

Keyboard shortcuts

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