adding cpu coretemp-isa, and more nvme-pci
This commit is contained in:
parent
f12dbbf2bc
commit
32eec97d6a
@ -34,30 +34,32 @@ pub struct Sensor {
|
||||
#[serde(rename = "Adapter")]
|
||||
_adapter: String,
|
||||
|
||||
#[serde(rename = "Tctl")]
|
||||
#[serde(rename = "Tctl", skip_serializing_if = "Option::is_none")]
|
||||
tctl: Option<BTreeMap<String, f64>>,
|
||||
|
||||
#[serde(rename = "Tccd1")]
|
||||
#[serde(rename = "Tccd1", skip_serializing_if = "Option::is_none")]
|
||||
tccd1: Option<BTreeMap<String, f64>>,
|
||||
temp1: Option<BTreeMap<String, f64>>,
|
||||
|
||||
#[serde(rename = "Composite")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
temp1: Option<BTreeMap<String, f64>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
temp2: Option<BTreeMap<String, f64>>,
|
||||
|
||||
#[serde(rename = "Package id 0", skip_serializing_if = "Option::is_none")]
|
||||
package_id_0: Option<BTreeMap<String, f64>>,
|
||||
|
||||
#[serde(rename = "Composite", skip_serializing_if = "Option::is_none")]
|
||||
composite: Option<BTreeMap<String, f64>>,
|
||||
}
|
||||
|
||||
impl Sensor {
|
||||
pub fn temp(&self) -> Option<f64> {
|
||||
let sensor = self.actual_sector();
|
||||
match sensor {
|
||||
None => return None,
|
||||
Some(temperatures) => {
|
||||
let temperatures = self.actual_sector()?;
|
||||
for temp_name in TEMP_NAMES {
|
||||
if let Some(temp) = temperatures.get(temp_name) {
|
||||
return Some(*temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
@ -74,6 +76,14 @@ impl Sensor {
|
||||
return self.temp1.clone();
|
||||
}
|
||||
|
||||
if self.temp2.is_some() {
|
||||
return self.temp2.clone();
|
||||
}
|
||||
|
||||
if self.package_id_0.is_some() {
|
||||
return self.package_id_0.clone();
|
||||
}
|
||||
|
||||
if self.composite.is_some() {
|
||||
return self.composite.clone();
|
||||
}
|
||||
|
@ -39,6 +39,6 @@ fn print_gpu_temp() {
|
||||
}
|
||||
|
||||
fn debug() {
|
||||
println!("lm-sensors: {:?}", sensors_data());
|
||||
println!("nvidia-smi: {:?}", temperature());
|
||||
println!("lm-sensors: {:#?}", sensors_data());
|
||||
println!("nvidia-smi: {:#?}", temperature());
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
pub const TEMP_NAMES: [&str; 1] = ["temp1_input"];
|
||||
pub const CPU_NAMES: [&str; 1] = ["k10temp-pci-00c3"];
|
||||
pub const DISK_NAMES: [&str; 1] = ["nvme-pci-0100"];
|
||||
|
||||
pub const CPU_NAMES: [&str; 2] = ["k10temp-pci-00c3", "coretemp-isa-0000"];
|
||||
pub const DISK_NAMES: [&str; 3] = ["nvme-pci-0100", "nvme-pci-0200", "nvme-pci-0300"];
|
||||
|
Loading…
x
Reference in New Issue
Block a user