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 ¶
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 ¶
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
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 ¶
Sample collects a best-effort snapshot of host vitals; missing sources are simply absent from the result.
func SetNow ¶ added in v0.20.0
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.