Expand description
gpuviewer-core — telemetry collection, data model, and event derivation.
Architecture (see CLAUDE.md and docs/research/04-synthesis.md):
backend::GpuBackend: nvtop’s vendor-vtable split (static / dynamic / processes), per-fieldOption<T>, runtime-loaded vendor libs, failed init = skipped backend.events::EventEngine: derives the narrated “story” events from raw samples.mock::MockBackend: scripted simulation for CI/demos; the contract for real backends.
Re-exports§
pub use backend::all_backends;pub use backend::BackendError;pub use backend::GpuBackend;pub use events::Confidence;pub use events::Event;pub use events::EventEngine;pub use events::EventKind;pub use events::Severity;pub use model::fmt_bytes;pub use model::normalize_pci_id;pub use model::now_ms;pub use model::DeviceId;pub use model::DynamicSample;pub use model::ProcessKind;pub use model::ProcessSample;pub use model::StaticInfo;pub use model::ThrottleReasons;pub use model::Vendor;pub use proc_meta::container_of;pub use proc_meta::parse_cgroup;pub use proc_meta::CpuTracker;
Modules§
- amd
- AMD Linux backend — hand-rolled
std::fsreaders over sysfs/hwmon/fdinfo. No library linkage at all: librocm_smi64 is explicitly off the table (soname churn broke btop twice — btop #774) and libdrm ioctls are unnecessary for everything v1 needs. - backend
- The vendor backend abstraction — nvtop’s
struct gpu_vendorvtable, translated to Rust. - events
- Event derivation — the “story” layer.
- intel
- Intel Linux backend — hand-rolled
std::fsreaders over sysfs/fdinfo, no library linkage (no Level Zero, no IGCL: per docs/research/02 their Linux coverage is gappy and root-gated; plain fdinfo+sysfs is the strong path). - mock
- Mock backend: deterministic-ish simulation used for CI and demos (no GPU required).
- model
- Core data model. Every metric is
Option<T>: absence (NOT_SUPPORTED, missing sysfs file, privilege wall) is a normal per-metric outcome, never an error. - nvidia
- NVIDIA backend — direct NVML calls via
nvml-wrapper(runtime-loads the driver’s ownlibnvidia-ml.so.1/nvml.dll). No nvidia-smi anywhere: nvidia-smi is itself just a CLI wrapper over this same library. - proc_
meta - Shared Linux per-process metadata helpers used across every Linux backend.
- wddm
- Windows cross-vendor WDDM backend (docs/design/cross-platform.md §3) — AMD and Intel
on Windows (and NVIDIA when NVML is absent), entirely from OS surfaces: DXGI for
enumeration and VRAM totals, PDH GPU counters for utilization and memory, D3DKMT for
the LUID→PCI identity.
pdh.dll/gdi32.dll/dxgi.dllare OS system libraries — linking them via thewindowscrate does NOT violate the no-vendor-SDK rule (that rule targets vendor SDKs with soname churn, not the OS itself).