mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2026-08-19 01:14:43 -05:00
feat: add fan speed RPM reporting on nvidia
This commit is contained in:
Generated
+2
-2
@@ -1657,7 +1657,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nvml-wrapper"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/ilya-zlobintsev/nvml-wrapper?branch=lact#7802f6f074467f14a11aefa8ee5d75c32319eb7c"
|
||||
source = "git+https://github.com/ilya-zlobintsev/nvml-wrapper?branch=feature/pstate-wrappers#d245c3010c72466cfb572f5baf91c91f7294bb36"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"libloading",
|
||||
@@ -1670,7 +1670,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nvml-wrapper-sys"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/ilya-zlobintsev/nvml-wrapper?branch=lact#7802f6f074467f14a11aefa8ee5d75c32319eb7c"
|
||||
source = "git+https://github.com/ilya-zlobintsev/nvml-wrapper?branch=feature/pstate-wrappers#d245c3010c72466cfb572f5baf91c91f7294bb36"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
@@ -32,7 +32,7 @@ indexmap = { workspace = true }
|
||||
divan = { workspace = true, optional = true }
|
||||
serde_yaml = { workspace = true }
|
||||
|
||||
nvml-wrapper = { git = "https://github.com/ilya-zlobintsev/nvml-wrapper", branch = "lact" }
|
||||
nvml-wrapper = { git = "https://github.com/ilya-zlobintsev/nvml-wrapper", branch = "feature/pstate-wrappers" }
|
||||
bitflags = "2.6.0"
|
||||
pciid-parser = { version = "0.8", features = ["serde"] }
|
||||
zbus = { version = "5.3.1", default-features = false, features = ["tokio"] }
|
||||
|
||||
@@ -374,7 +374,7 @@ impl GpuController for NvidiaGpuController {
|
||||
clippy::cast_sign_loss
|
||||
)]
|
||||
fn get_stats(&self, gpu_config: Option<&config::Gpu>) -> DeviceStats {
|
||||
let mut device = self.device();
|
||||
let device = self.device();
|
||||
|
||||
let mut temps = HashMap::new();
|
||||
|
||||
@@ -396,13 +396,33 @@ impl GpuController for NvidiaGpuController {
|
||||
|
||||
let fan_settings = gpu_config.and_then(|config| config.fan_control_settings.as_ref());
|
||||
|
||||
let pwm_current = if device.num_fans().is_ok_and(|num| num > 0) {
|
||||
device
|
||||
.fan_speed(0)
|
||||
.ok()
|
||||
.map(|value| (f64::from(value) * 2.55) as u8)
|
||||
let num_fans = device.num_fans().unwrap_or(0);
|
||||
|
||||
let (pwm_current, speed_current) = if num_fans == 0 {
|
||||
(None, None)
|
||||
} else {
|
||||
None
|
||||
let fan_speeds = (0..num_fans)
|
||||
.flat_map(|idx| device.fan_speed(idx))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let pwm_current = if fan_speeds.is_empty() {
|
||||
None
|
||||
} else {
|
||||
let avg_speed: u32 = fan_speeds.iter().sum::<u32>() / fan_speeds.len() as u32;
|
||||
Some((f64::from(avg_speed) * 2.55) as u8)
|
||||
};
|
||||
|
||||
let fan_speeds_rpm = (0..num_fans)
|
||||
.flat_map(|idx| device.fan_speed_rpm(idx))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let speed_current = if fan_speeds_rpm.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(fan_speeds_rpm.iter().sum::<u32>() / fan_speeds_rpm.len() as u32)
|
||||
};
|
||||
|
||||
(pwm_current, speed_current)
|
||||
};
|
||||
|
||||
let vram = device
|
||||
@@ -429,7 +449,7 @@ impl GpuController for NvidiaGpuController {
|
||||
curve: fan_settings.map(|settings| settings.curve.0.clone()),
|
||||
spindown_delay_ms: fan_settings.and_then(|settings| settings.spindown_delay_ms),
|
||||
change_threshold: fan_settings.and_then(|settings| settings.change_threshold),
|
||||
speed_current: None,
|
||||
speed_current,
|
||||
speed_max: fan_range.map(|range| range.1),
|
||||
speed_min: fan_range.map(|range| range.0),
|
||||
pwm_current,
|
||||
|
||||
Reference in New Issue
Block a user