trueno_gpu/monitor/tui_layout/
render_state.rs1use std::collections::VecDeque;
4
5use crate::monitor::device::DeviceId;
6use crate::monitor::memory::PressureLevel;
7
8#[derive(Debug, Clone)]
14pub struct TuiRenderState {
15 pub cpu: Option<DeviceRenderState>,
17 pub gpus: Vec<DeviceRenderState>,
19 pub memory: MemoryRenderState,
21 pub data_flow: DataFlowRenderState,
23 pub kernels: Vec<KernelRenderState>,
25 pub pressure: PressureLevel,
27 pub stress_active: bool,
29 pub paused: bool,
31 pub focused_section: usize,
33 pub error: Option<String>,
35}
36
37impl Default for TuiRenderState {
38 fn default() -> Self {
39 Self {
40 cpu: None,
41 gpus: Vec::new(),
42 memory: MemoryRenderState::default(),
43 data_flow: DataFlowRenderState::default(),
44 kernels: Vec::new(),
45 pressure: PressureLevel::Ok,
46 stress_active: false,
47 paused: false,
48 focused_section: 0,
49 error: None,
50 }
51 }
52}
53
54#[derive(Debug, Clone)]
56pub struct DeviceRenderState {
57 pub device_id: DeviceId,
59 pub name: String,
61 pub utilization_pct: f64,
63 pub temperature_c: f64,
65 pub power_watts: f64,
67 pub power_limit_watts: f64,
69 pub clock_mhz: u32,
71 pub history: VecDeque<f64>,
73}
74
75#[derive(Debug, Clone, Default)]
77pub struct MemoryRenderState {
78 pub ram_pct: f64,
80 pub ram_used_gb: f64,
82 pub ram_total_gb: f64,
84 pub swap_pct: f64,
86 pub swap_used_gb: f64,
88 pub swap_total_gb: f64,
90 pub vram: Vec<(DeviceId, f64, f64, f64)>, pub ram_history: VecDeque<f64>,
94}
95
96#[derive(Debug, Clone, Default)]
98pub struct DataFlowRenderState {
99 pub pcie_tx_gbps: f64,
101 pub pcie_rx_gbps: f64,
103 pub pcie_theoretical_gbps: f64,
105 pub memory_bus_pct: f64,
107 pub transfers: Vec<(String, String, f64)>, }
110
111#[derive(Debug, Clone)]
113pub struct KernelRenderState {
114 pub name: String,
116 pub device_id: DeviceId,
118 pub progress_pct: f64,
120 pub grid: String,
122 pub elapsed_ms: f64,
124}