mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: add special case for invalid throttle mask
This commit is contained in:
parent
4a567c3345
commit
5f95a4dc12
@ -20,7 +20,7 @@ use lact_schema::{
|
|||||||
ClocksInfo, ClockspeedStats, DeviceInfo, DeviceStats, DrmInfo, FanStats, GpuPciInfo, LinkInfo,
|
ClocksInfo, ClockspeedStats, DeviceInfo, DeviceStats, DrmInfo, FanStats, GpuPciInfo, LinkInfo,
|
||||||
PciInfo, PmfwInfo, PowerState, PowerStates, PowerStats, VoltageStats, VramStats,
|
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 pciid_parser::Database;
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
@ -466,10 +466,18 @@ impl AmdGpuController {
|
|||||||
self.drm_handle
|
self.drm_handle
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|drm_handle| drm_handle.get_gpu_metrics().ok())
|
.and_then(|drm_handle| drm_handle.get_gpu_metrics().ok())
|
||||||
.and_then(|metrics| metrics.get_throttle_status_info())
|
.and_then(|metrics| metrics.get_indep_throttle_status())
|
||||||
.map(|throttle| {
|
.map(|throttle_value| {
|
||||||
let mut grouped_bits: HashMap<ThrottlerType, HashSet<u8>> = HashMap::new();
|
let mut grouped_bits: HashMap<ThrottlerType, HashSet<u8>> = 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() {
|
for bit in throttle.get_all_throttler() {
|
||||||
let throttle_type = ThrottlerType::from(bit);
|
let throttle_type = ThrottlerType::from(bit);
|
||||||
grouped_bits
|
grouped_bits
|
||||||
|
Loading…
Reference in New Issue
Block a user