diff --git a/lact-daemon/src/server/gpu_controller/amd.rs b/lact-daemon/src/server/gpu_controller/amd.rs index 6861c45..6cedfd1 100644 --- a/lact-daemon/src/server/gpu_controller/amd.rs +++ b/lact-daemon/src/server/gpu_controller/amd.rs @@ -20,7 +20,7 @@ use lact_schema::{ ClocksInfo, ClockspeedStats, DeviceInfo, DeviceStats, DrmInfo, FanStats, GpuPciInfo, LinkInfo, PciInfo, PmfwInfo, PowerState, PowerStates, PowerStats, VoltageStats, VramStats, }; -use libdrm_amdgpu_sys::AMDGPU::ThrottlerBit; +use libdrm_amdgpu_sys::AMDGPU::{ThrottleStatus, ThrottlerBit}; use pciid_parser::Database; use std::{ cell::RefCell, @@ -466,10 +466,18 @@ impl AmdGpuController { self.drm_handle .as_ref() .and_then(|drm_handle| drm_handle.get_gpu_metrics().ok()) - .and_then(|metrics| metrics.get_throttle_status_info()) - .map(|throttle| { + .and_then(|metrics| metrics.get_indep_throttle_status()) + .map(|throttle_value| { let mut grouped_bits: HashMap> = HashMap::new(); + if throttle_value == u64::MAX { + return [("Everything".to_owned(), vec!["Yes".to_owned()])] + .into_iter() + .collect(); + } + + let throttle = ThrottleStatus::new(throttle_value); + for bit in throttle.get_all_throttler() { let throttle_type = ThrottlerType::from(bit); grouped_bits