How hans-kramer/qcstats works
qcstats is a board-specific telemetry sampler for the Arduino Ventuno Q. Its principal workflow parses sampling and output options, opens independent samplers, collects readings into a shared sample, and emits plain, NDJSON, or CSV output on a timed loop. Telemetry spans CPU, memory, GPU, thermal, power, fan, throttling, and optional NPU and GPU-busy metrics; run-level kernel and image provenance is also reported. The excerpts show the shared sampler and platform-I/O layers. Several sensor implementations were not excerpted, so their dispatch links rely on the documented sampler interface and main’s sampler list.
Main entry points: main.c CLI and loop · io.c Platform I/O · qcstats.h Sample model · emit.c Output formats
Components 19
Sampling runtime
- CLI and loop
src/main.c
Telemetry sources
- CPU metrics
src/cpu.c - Memory metrics
src/mem.c - GPU frequency
src/gpu.c - Thermal zones
src/thermal.c - Power metrics
src/power.c - Fan metrics
src/fan.c - Throttle events
src/throttle.c - NPU metrics
src/npu.c - GPU busy trace
src/gputrace.c
Platform access
- Platform I/O
src/io.c - Run provenance
src/envid.c
Sample and output
- Sample model
src/qcstats.h - Output formats
src/emit.c
Other components
- Operator
- Linux procfs/sysfs
- Linux tracefs
- FastRPC service
- Output consumer
Connections 31
- Operator → CLI and loop: sets options
README.md - CLI and loop → CPU metrics: dispatches sampler
src/main.c - CLI and loop → Memory metrics: dispatches sampler
src/main.c - CLI and loop → GPU frequency: dispatches sampler
src/main.c - CLI and loop → Thermal zones: dispatches sampler
src/main.c - CLI and loop → Power metrics: dispatches sampler
src/main.c - CLI and loop → Fan metrics: dispatches sampler
src/main.c - CLI and loop → Throttle events: dispatches sampler
src/main.c - CLI and loop → NPU metrics: dispatches sampler
src/main.c - CLI and loop → GPU busy trace: dispatches sampler
src/main.c - CPU metrics → Platform I/O: reads sources
src/cpu.c - Memory metrics → Platform I/O: reads sources
src/mem.c - GPU frequency → Platform I/O: reads sources
src/gpu.c - Thermal zones → Platform I/O: resolves and reads
src/thermal.c - Power metrics → Platform I/O: reads sources
src/power.c - Fan metrics → Platform I/O: reads sources
src/fan.c - Throttle events → Platform I/O: reads sources
src/throttle.c - Platform I/O → Linux procfs/sysfs: reads
src/io.c - NPU metrics → FastRPC service: queries optionally
README.md - GPU busy trace → Linux tracefs: enables and reads
src/gputrace.c - CLI and loop → Run provenance: reads once
src/main.c - Run provenance → Platform I/O: reads files
src/envid.c - CLI and loop → Sample model: collects readings
src/main.c - CPU metrics → Sample model: fills metrics
src/cpu.c - Thermal zones → Sample model: fills metrics
src/thermal.c - NPU metrics → Sample model: fills metrics
- GPU busy trace → Sample model: fills metrics
src/gputrace.c - CLI and loop → Output formats: emits selected format
README.md - Sample model → Output formats: formats sample
src/emit.c - Run provenance → Output formats: adds provenance
- Output formats → Output consumer: writes output
src/emit.c