machine

package
v1.999.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

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