Expand description
§hypomnesis
External measurement of a Rust process’s RAM and VRAM state, on Windows and Linux.
hypomnesis reports what’s currently in a process’s memory — process RSS,
device-wide GPU memory, and per-process GPU VRAM — without depending on
candle, cudarc, sysinfo, or any inference framework.
§Capabilities
| Metric | Windows | Linux |
|---|---|---|
Process RSS | K32GetProcessMemoryInfo | /proc/self/status |
| Device-wide GPU memory | NVML (nvml.dll) | NVML (libnvidia-ml.so.1) |
| Per-process GPU memory | DXGI (IDXGIAdapter3::QueryVideoMemoryInfo) | NVML (nvmlDeviceGetComputeRunningProcesses) |
| Compute-process listing (other PIDs) | nvidia-smi --query-compute-apps | NVML + /proc/<pid>/comm |
| Fallback | nvidia-smi subprocess | nvidia-smi subprocess |
§Quick start
let snap = hypomnesis::Snapshot::now(0)?;
println!("RAM: {} bytes", snap.ram_bytes);
if let Some(dev) = snap.gpu_device {
println!("GPU 0: {:?}, free {} of {} bytes",
dev.name, dev.free_bytes, dev.total_bytes);
}§Feature flags
| Feature | Default | Description |
|---|---|---|
nvml | yes | NVML dynamic load via libloading (Linux + Windows-WDDM device-wide) |
dxgi | yes | Windows per-process VRAM via IDXGIAdapter3 (no-op on non-Windows) |
nvidia-smi-fallback | yes | Subprocess fallback when NVML / DXGI fail |
report | no | MemoryReport delta + print_delta / print_before_after / ram_mb / vram_mb helpers (candle-mi parity); format_free / print_free / format_total / format_used formatting helpers on GpuDeviceInfo |
debug-output | no | Print raw NVML / DXGI values to stderr (diagnostic) |
cli | no | Build the hmn CLI binary (pulls clap 4 as a dep). Library users do not need this; install via cargo install hypomnesis --features cli |
test-helpers | no | Expose GpuDeviceInfoBuilder for downstream tests that need synthetic GpuDeviceInfo fixtures. Default-off, additive — production code must never enable it. |
Re-exports§
pub use error::HypomnesisError;pub use error::Result;pub use gpu::device_count;pub use gpu::device_info;pub use gpu::gpu_processes;pub use gpu::process_gpu_info;pub use ram::process_rss;pub use snapshot::GpuDeviceInfo;pub use snapshot::GpuProcessEntry;pub use snapshot::GpuQuerySource;pub use snapshot::ProcessGpuInfo;pub use snapshot::Snapshot;pub use report::MemoryReport;pub use snapshot::GpuDeviceInfoBuilder;