Skip to content

Commit

Permalink
Fix Windows CPU frequency not refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
Radu Bloch committed Nov 26, 2024
1 parent 1fd8cd1 commit b82082f
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/windows/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ impl Query {
pub(crate) struct CpusWrapper {
pub(crate) global: CpuUsage,
cpus: Vec<Cpu>,
got_cpu_frequency: bool,
}

impl CpusWrapper {
Expand All @@ -261,7 +260,6 @@ impl CpusWrapper {
key_used: None,
},
cpus: Vec::new(),
got_cpu_frequency: false,
}
}

Expand All @@ -276,7 +274,6 @@ impl CpusWrapper {
fn init_if_needed(&mut self, refresh_kind: CpuRefreshKind) {
if self.cpus.is_empty() {
self.cpus = init_cpus(refresh_kind);
self.got_cpu_frequency = refresh_kind.frequency();
}
}

Expand All @@ -291,15 +288,11 @@ impl CpusWrapper {
}

pub fn get_frequencies(&mut self) {
if self.got_cpu_frequency {
return;
}
let frequencies = get_frequencies(self.cpus.len());

for (cpu, frequency) in self.cpus.iter_mut().zip(frequencies) {
cpu.inner.set_frequency(frequency);
}
self.got_cpu_frequency = true;
}
}

Expand Down

0 comments on commit b82082f

Please sign in to comment.