adding cpu coretemp-isa, and more nvme-pci
This commit is contained in:
parent
f12dbbf2bc
commit
32eec97d6a
@ -34,28 +34,30 @@ pub struct Sensor {
|
|||||||
#[serde(rename = "Adapter")]
|
#[serde(rename = "Adapter")]
|
||||||
_adapter: String,
|
_adapter: String,
|
||||||
|
|
||||||
#[serde(rename = "Tctl")]
|
#[serde(rename = "Tctl", skip_serializing_if = "Option::is_none")]
|
||||||
tctl: Option<BTreeMap<String, f64>>,
|
tctl: Option<BTreeMap<String, f64>>,
|
||||||
|
|
||||||
#[serde(rename = "Tccd1")]
|
#[serde(rename = "Tccd1", skip_serializing_if = "Option::is_none")]
|
||||||
tccd1: Option<BTreeMap<String, f64>>,
|
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>>,
|
composite: Option<BTreeMap<String, f64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sensor {
|
impl Sensor {
|
||||||
pub fn temp(&self) -> Option<f64> {
|
pub fn temp(&self) -> Option<f64> {
|
||||||
let sensor = self.actual_sector();
|
let temperatures = self.actual_sector()?;
|
||||||
match sensor {
|
for temp_name in TEMP_NAMES {
|
||||||
None => return None,
|
if let Some(temp) = temperatures.get(temp_name) {
|
||||||
Some(temperatures) => {
|
return Some(*temp);
|
||||||
for temp_name in TEMP_NAMES {
|
|
||||||
if let Some(temp) = temperatures.get(temp_name) {
|
|
||||||
return Some(*temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
@ -74,6 +76,14 @@ impl Sensor {
|
|||||||
return self.temp1.clone();
|
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() {
|
if self.composite.is_some() {
|
||||||
return self.composite.clone();
|
return self.composite.clone();
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,6 @@ fn print_gpu_temp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn debug() {
|
fn debug() {
|
||||||
println!("lm-sensors: {:?}", sensors_data());
|
println!("lm-sensors: {:#?}", sensors_data());
|
||||||
println!("nvidia-smi: {:?}", temperature());
|
println!("nvidia-smi: {:#?}", temperature());
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
pub const TEMP_NAMES: [&str; 1] = ["temp1_input"];
|
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