Module parse

Module parse 

Source
Expand description

2026-09-26: Pure parsers for the nvidia-smi, procfs and sysfs text that super::collect reads.

Owner: bench hardware. Invariants:

  • &str in, data out: no I/O, so the fixtures in fixtures/ exercise every parser.
  • A number that does not parse is None, or its row or zone is dropped; no parser substitutes a default, so a caller can tell “0 µs of throttling” from “no idea”.

Structs§

GpuQuery
2026-09-26: The first non-blank CSV row of --query-gpu=name,driver_version,clocks.sm,clocks.max.sm,temperature.gpu,persistence_mode with --format=csv,noheader,nounits.
MemInfo
2026-09-26: MemTotal, MemAvailable and Cached from /proc/meminfo, kB.

Functions§

compute_apps
2026-09-26: The rows of --query-compute-apps=pid,process_name,used_memory --format=csv,noheader,nounits.
gpu_count
2026-09-26: The device count from nvidia-smi -L, one line per visible device.
gpu_query
meminfo
milli_celsius
2026-09-26: A /sys/class/thermal/thermal_zone*/temp file, milli-degrees Celsius, as °C; None when it is not a finite number.
performance
2026-09-26: The counters and the asserted reasons from nvidia-smi -q -d PERFORMANCE.
thermal_zone
2026-09-26: Assemble one zone from its type and temp file contents.