machine

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 12 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

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

type NetStatistics

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

NetStatistics can compute the network statistics

func (*NetStatistics) BpsRecv

func (ns *NetStatistics) BpsRecv() uint64

BpsRecv bytes received per second on all interfaces

func (*NetStatistics) BpsRecvPeak

func (ns *NetStatistics) BpsRecvPeak() uint64

BpsRecvPeak peak bytes received per second on all interfaces

func (*NetStatistics) BpsSent

func (ns *NetStatistics) BpsSent() uint64

BpsSent bytes sent per second on all interfaces

func (*NetStatistics) BpsSentPeak

func (ns *NetStatistics) BpsSentPeak() uint64

BpsSentPeak peak bytes sent per second on all interfaces

func (*NetStatistics) ComputeStatistics

func (ns *NetStatistics) ComputeStatistics()

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

func (*NetStatistics) PercentRecv

func (ns *NetStatistics) PercentRecv() uint64

PercentRecv BpsRecv / BpsRecvPeak * 100

func (*NetStatistics) PercentSent

func (ns *NetStatistics) PercentSent() uint64

PercentSent BpsSent / BpsSentPeak * 100

Jump to

Keyboard shortcuts

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