fix: look for first non-zero energy reading on intel

This commit is contained in:
Ilya Zlobintsev
2025-06-05 20:39:59 +03:00
parent b80e3c070f
commit 74d74e6dca
163 changed files with 281 additions and 1 deletions
@@ -334,7 +334,11 @@ impl IntelGpuController {
fn get_power_usage(&self) -> Option<f64> { fn get_power_usage(&self) -> Option<f64> {
self.read_hwmon_file::<u64>("power", "_input") self.read_hwmon_file::<u64>("power", "_input")
.or_else(|| { .or_else(|| {
let energy = self.read_hwmon_file::<u64>("energy", "_input")?; // Use first non-zero energy reading
let energy = self
.read_hwmon_files::<u64>("energy", "_input")
.map(|(value, _)| value)
.find(|value| *value != 0)?;
let timestamp = Instant::now(); let timestamp = Instant::now();
#[cfg(not(test))] #[cfg(not(test))]
@@ -0,0 +1 @@
226:1
@@ -0,0 +1 @@
2.5 GT/s PCIe
@@ -0,0 +1 @@
7711472839
@@ -0,0 +1 @@
380000000

Some files were not shown because too many files have changed in this diff Show More