trueno/monitor/
compute_device.rs1#![allow(missing_docs)]
2#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6pub struct DeviceId(pub u32);
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum DeviceType {
10 Cpu,
11 NvidiaGpu,
12 AmdGpu,
13 IntelGpu,
14 AppleSilicon,
15 Hpu, }
17
18pub trait ComputeDevice: Send + Sync {
20 fn device_id(&self) -> DeviceId;
22 fn device_name(&self) -> &str;
23 fn device_type(&self) -> DeviceType;
24
25 fn compute_utilization(&self) -> anyhow::Result<f64>; fn compute_clock_mhz(&self) -> anyhow::Result<u32>;
28 fn compute_temperature_c(&self) -> anyhow::Result<f64>;
29 fn compute_power_watts(&self) -> anyhow::Result<f64>;
30 fn compute_power_limit_watts(&self) -> anyhow::Result<f64>;
31
32 fn memory_used_bytes(&self) -> anyhow::Result<u64>;
34 fn memory_total_bytes(&self) -> anyhow::Result<u64>;
35 fn memory_bandwidth_gbps(&self) -> anyhow::Result<f64>;
36
37 fn sm_count(&self) -> u32;
39 fn active_sm_count(&self) -> anyhow::Result<u32>;
40
41 fn pcie_tx_bytes_per_sec(&self) -> anyhow::Result<u64>;
43 fn pcie_rx_bytes_per_sec(&self) -> anyhow::Result<u64>;
44 fn pcie_generation(&self) -> u8;
45 fn pcie_width(&self) -> u8;
46}