Skip to content

Commit

Permalink
Fix linux temp
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Oct 1, 2024
1 parent 7874629 commit 13f0a3f
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions platforms/unix/hardwareinfo/src/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use log::debug;
use std::{sync::LazyLock, time::SystemTime};

use drive::DriveData;
use log::{debug, info};

use crate::{compare_sensor, CoresDisk, CoresRAMInfo, CoresSensor, Data, Round};

pub mod cpu;
Expand Down Expand Up @@ -104,12 +102,14 @@ pub fn linux_hardware_info(data: &mut Data) {
}
} else {
// CPU
let logical_cpus = data.sys.cpus().len();
let prev_temp = data.hw_info.cpu.temperature[0].clone();
if data.hw_info.cpu.temperature.len() > 0 {
let logical_cpus = data.sys.cpus().len();
let prev_temp = data.hw_info.cpu.temperature[0].clone();

let cpu_data = cpu::CpuData::new(logical_cpus);
if let Ok(temp) = cpu_data.temperature {
data.hw_info.cpu.temperature[0] = compare_sensor(&prev_temp, temp as f64);
let cpu_data = cpu::CpuData::new(logical_cpus);
if let Ok(temp) = cpu_data.temperature {
data.hw_info.cpu.temperature[0] = compare_sensor(&prev_temp, temp as f64);
}
}

// Drives
Expand Down Expand Up @@ -151,11 +151,4 @@ pub fn linux_hardware_info(data: &mut Data) {
}
}
}

// let disks = &data.hw_info.system.storage.disks;
// for disk in disks {
// let inner = &disk.inner;
// let time_passed = 5.0;
// let delta_write_sectors = inner.clone().sys_stats().unwrap().get("write_sectors").unwrap_or(&0).saturating_sub(rhs);
// }
}

0 comments on commit 13f0a3f

Please sign in to comment.