osm

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastCPUStats

func LastCPUStats() cpu.CPUStats

LastCPUStats get the last cpu stats

func LastCPUUsage

func LastCPUUsage() cpu.CPUUsage

LastCPUUsage get the last cpu usage

func Monitoring

func Monitoring() bool

Monitoring return the monitor is running or not

func SetDefault

func SetDefault(sm *StatsMonitor)

SetDefault set the default StatsMonitor instance used by the package-level functions.

func Start

func Start()

Start start monitor

func Stop

func Stop()

Stop stop monitor

Types

type StatsMonitor

type StatsMonitor struct {
	Logger    log.Logger
	Interval  time.Duration // stats collect interval
	DiskFree  int64         // disk free threshold (average by count)
	DiskCount int           // disk stats collect count
	CPUUsage  float64       // cpu usage threshold (average by count)
	CPUCount  int           // cpu stats collect count
	MemUsage  float64       // memory usage threshold (average by count)
	MemCount  int           // mem stats collect count
	// contains filtered or unexported fields
}

func Default

func Default() *StatsMonitor

Default returns the default StatsMonitor instance used by the package-level functions.

func NewStatsMonitor

func NewStatsMonitor() *StatsMonitor

func (*StatsMonitor) Collect

func (sm *StatsMonitor) Collect()

func (*StatsMonitor) LastCPUStats

func (sm *StatsMonitor) LastCPUStats() cpu.CPUStats

LastCPUStats get the last cpu stats

func (*StatsMonitor) LastCPUUsage

func (sm *StatsMonitor) LastCPUUsage() cpu.CPUUsage

LastCPUUsage get the last cpu usage

func (*StatsMonitor) Monitoring

func (sm *StatsMonitor) Monitoring() bool

Monitoring return the monitor is running or not

func (*StatsMonitor) Start

func (sm *StatsMonitor) Start()

Start start monitor

func (*StatsMonitor) Stop

func (sm *StatsMonitor) Stop()

Stop stop monitor

Jump to

Keyboard shortcuts

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