pub struct TemperatureReading {
pub label: Box<str>,
pub celsius: f32,
pub peak_celsius: Option<f32>,
pub critical_celsius: Option<f32>,
}Expand description
One temperature sensor reading.
Fields§
§label: Box<str>Sensor label, e.g. coretemp Package id 0.
celsius: f32Current temperature in degrees Celsius.
peak_celsius: Option<f32>The highest value this sensor has been seen at, where the platform offers one.
Not a threshold, and deliberately not named like one. The underlying
interface reports either the sensor’s declared high limit or the maximum
value observed since the process started, depending on the platform and the
driver, and the two are indistinguishable from here. It is therefore useful
as context — “it has been this hot” — and never usable as a full scale for a
bar or a percentage. Only TemperatureReading::critical_celsius is a
declared ceiling.
critical_celsius: Option<f32>The critical threshold the sensor reports, where available.
The one figure here that is a genuine ceiling, which is why it is the only denominator anything is allowed to draw a scale against.
Implementations§
Source§impl TemperatureReading
impl TemperatureReading
Sourcepub fn is_critical(&self) -> Option<bool>
pub fn is_critical(&self) -> Option<bool>
Whether the reading is at or above the sensor’s own critical threshold.
Returns None when the sensor reports no threshold. §11.3 forbids
diagnosing thermal throttling from an ambiguous metric, so this only ever
reports what the sensor itself declares critical, and the diagnostic
engine draws no throttling conclusion from it.
The reading as a share of the sensor’s own declared ceiling.
None when the sensor declares none, which is what stops a caller drawing a
bar: a temperature has no natural full scale, and 62 °C is most of the way to
a laptop’s limit while being barely warm for a GPU. Deliberately refuses
TemperatureReading::peak_celsius as a substitute — a bar scaled against
the highest value seen so far would sit at 100% forever.
Lives here rather than in the UI so the refusal is the model’s, and every screen that wants a thermal bar gets the same answer (§7.4’s rule about utilization without a known capacity, applied to temperature).
Trait Implementations§
Source§impl Clone for TemperatureReading
impl Clone for TemperatureReading
Source§fn clone(&self) -> TemperatureReading
fn clone(&self) -> TemperatureReading
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more