Skip to content

Commit 3b263c6

Browse files
committed
feat: better cpu average temp (included efficiency cores in SMC)
1 parent b9e2ba1 commit 3b263c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/metrics.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ fn calc_freq_final(items: &Vec<(u32, f32)>, freqs: &Vec<u32>) -> (u32, f32) {
8686

8787
fn init_smc() -> WithError<(SMC, Vec<String>, Vec<String>)> {
8888
let mut smc = SMC::new()?;
89+
const FLOAT_TYPE: u32 = 1718383648; // FourCC: "flt "
8990

9091
let mut cpu_sensors = Vec::new();
9192
let mut gpu_sensors = Vec::new();
@@ -97,7 +98,7 @@ fn init_smc() -> WithError<(SMC, Vec<String>, Vec<String>)> {
9798
Err(_) => continue,
9899
};
99100

100-
if key.data_size != 4 || key.data_type != 1718383648 {
101+
if key.data_size != 4 || key.data_type != FLOAT_TYPE {
101102
continue;
102103
}
103104

@@ -110,7 +111,8 @@ fn init_smc() -> WithError<(SMC, Vec<String>, Vec<String>)> {
110111
// Basically in the code that can be found publicly "Tp" is used for CPU and "Tg" for GPU.
111112

112113
match name {
113-
name if name.starts_with("Tp") => cpu_sensors.push(name.clone()),
114+
// "Tp" – performance cores, "Te" – efficiency cores
115+
name if name.starts_with("Tp") || name.starts_with("Te") => cpu_sensors.push(name.clone()),
114116
name if name.starts_with("Tg") => gpu_sensors.push(name.clone()),
115117
_ => (),
116118
}

0 commit comments

Comments
 (0)