1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! GPU Monitoring, Tracing, and Visualization (TRUENO-SPEC-010)
//!
//! This module provides comprehensive GPU monitoring capabilities:
//! - Device discovery and information
//! - Real-time metrics collection
//! - Cross-platform support (wgpu + optional CUDA)
//!
//! # Design Philosophy
//!
//! **Dual-Backend Architecture**: Supports both wgpu (cross-platform) and
//! trueno-gpu (native CUDA) for maximum flexibility.
//!
//! # References
//!
//! - Nickolls et al. (2008): GPU parallel computing model
//! - Gregg (2016): Flame graph visualization
//! - btop: NVML/ROCm SMI patterns
//!
//! # Example
//!
//! ```rust,ignore
//! use trueno::monitor::{GpuDeviceInfo, GpuMonitor};
//!
//! // Query device information
//! let info = GpuDeviceInfo::query()?;
//! println!("GPU: {}", info.name);
//! println!("VRAM: {} MB", info.vram_total / (1024 * 1024));
//!
//! // Start background monitoring
//! let monitor = GpuMonitor::new(0)?;
//! let metrics = monitor.collect()?;
//! println!("VRAM used: {} / {}", metrics.memory.used, metrics.memory.total);
//! ```
// Re-export all public types at the module level
pub use cuda_monitor_available;
pub use ;
pub use ;
pub use ;
pub use GpuMonitor;
pub use GpuMemoryMetrics;
pub use ;
pub use ;