use std::collections::VecDeque;
use crate::monitor::device::DeviceId;
use crate::monitor::memory::PressureLevel;
#[derive(Debug, Clone)]
pub struct TuiRenderState {
pub cpu: Option<DeviceRenderState>,
pub gpus: Vec<DeviceRenderState>,
pub memory: MemoryRenderState,
pub data_flow: DataFlowRenderState,
pub kernels: Vec<KernelRenderState>,
pub pressure: PressureLevel,
pub stress_active: bool,
pub paused: bool,
pub focused_section: usize,
pub error: Option<String>,
}
impl Default for TuiRenderState {
fn default() -> Self {
Self {
cpu: None,
gpus: Vec::new(),
memory: MemoryRenderState::default(),
data_flow: DataFlowRenderState::default(),
kernels: Vec::new(),
pressure: PressureLevel::Ok,
stress_active: false,
paused: false,
focused_section: 0,
error: None,
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceRenderState {
pub device_id: DeviceId,
pub name: String,
pub utilization_pct: f64,
pub temperature_c: f64,
pub power_watts: f64,
pub power_limit_watts: f64,
pub clock_mhz: u32,
pub history: VecDeque<f64>,
}
#[derive(Debug, Clone, Default)]
pub struct MemoryRenderState {
pub ram_pct: f64,
pub ram_used_gb: f64,
pub ram_total_gb: f64,
pub swap_pct: f64,
pub swap_used_gb: f64,
pub swap_total_gb: f64,
pub vram: Vec<(DeviceId, f64, f64, f64)>, pub ram_history: VecDeque<f64>,
}
#[derive(Debug, Clone, Default)]
pub struct DataFlowRenderState {
pub pcie_tx_gbps: f64,
pub pcie_rx_gbps: f64,
pub pcie_theoretical_gbps: f64,
pub memory_bus_pct: f64,
pub transfers: Vec<(String, String, f64)>, }
#[derive(Debug, Clone)]
pub struct KernelRenderState {
pub name: String,
pub device_id: DeviceId,
pub progress_pct: f64,
pub grid: String,
pub elapsed_ms: f64,
}