Skip to content

Commit

Permalink
Merge pull request #953 from GuillaumeGomez/fix-missing-global-cpu-fr…
Browse files Browse the repository at this point in the history
…equency

Add missing frequency for global CPU on windows and freebsd
  • Loading branch information
GuillaumeGomez committed Mar 16, 2023
2 parents fe653a2 + b708696 commit cf40e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/freebsd/system.rs
Expand Up @@ -145,6 +145,9 @@ impl SystemExt for System {
self.system_info
.get_cpu_usage(&mut self.global_cpu, &mut self.cpus);
}
if refresh_kind.frequency() {
self.global_cpu.frequency = self.cpus.get(0).map(|cpu| cpu.frequency).unwrap_or(0);
}
}

fn refresh_components_list(&mut self) {
Expand Down
2 changes: 2 additions & 0 deletions src/windows/cpu.rs
Expand Up @@ -296,6 +296,8 @@ impl CpusWrapper {
for (cpu, frequency) in self.cpus.iter_mut().zip(frequencies) {
cpu.set_frequency(frequency);
}
self.global
.set_frequency(self.cpus.get(0).map(|cpu| cpu.frequency()).unwrap_or(0));
self.got_cpu_frequency = true;
}
}
Expand Down

0 comments on commit cf40e06

Please sign in to comment.