sysmon

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package sysmon samples host vitals: RAM, swap, load, temperatures, CPU model, OS and kernel identity, driver versions, GPUs and NPUs. Platform implementations live in sysmon_<goos>.go files selected by build tags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLoadavg

func ParseLoadavg(s string) (l1, l5, l15 float64)

ParseLoadavg reads "1.5 0.7 0.3 extra..." into three load averages. NaN, ±Inf and negatives (ParseFloat accepts all of them) collapse to zero rather than reaching the load readout.

func ParseMeminfo

func ParseMeminfo(b []byte, s *core.SysSample)

ParseMeminfo fills memory fields from the Linux /proc/meminfo format. Only the four keys the sample reads are kept: a map of all ~54 lines allocated per poll for a file whose interesting values never change.

func ParseUptimeSecs added in v0.6.0

func ParseUptimeSecs(s string) time.Duration

ParseUptimeSecs converts a /proc/uptime first field (seconds, possibly fractional) into a duration. A non-finite or out-of-range value must not convert to a wrapped or negative Duration (time.Duration(+Inf) is implementation-defined, often MinInt64 on amd64).

func Sample

func Sample() core.SysSample

Sample collects a best-effort snapshot of host vitals; missing sources are simply absent from the result.

func SetNow added in v0.20.0

func SetNow(fn func() time.Time)

SetNow overrides the clock the platform caches age against, restoring the wall clock for nil. Call it before sampling starts, the way provider.SetNow asks: the caches are package state shared by every caller, so a swap made mid-run moves their windows under the goroutines reading them. It does not touch the I/O the sampler does, the way a request deadline stays real time.

gpu is forwarded to because Sample calls it inside the same pass: its vendor-CLI memo and outage latch age the same windows as the caches here, and left on the wall clock a frame's GPU strip would not be reproducible for the reason the host strip is not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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