Skip to content

Commit

Permalink
fix: 修复当前频率解析失败
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow3aaa committed May 25, 2024
1 parent fd9d65c commit 89463bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cpu_common/policy/insider/cpuinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ impl CpuTimeSlice {
let total_slice = self.total.saturating_sub(last_slice.total);
let idle_slice = self.idle.saturating_sub(last_slice.idle);

idle_slice as f64 / total_slice as f64
(total_slice - idle_slice) as f64 / total_slice as f64
}
}

impl Insider {
pub fn current_freq(&self) -> Result<Freq> {
let scaling_cur_freq = self.path.join("scaling_cur_freq");
let freq: Freq = fs::read_to_string(scaling_cur_freq)?.parse()?;
let freq: Freq = fs::read_to_string(scaling_cur_freq)?.trim().parse()?;
Ok(freq)
}

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_common/policy/insider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Insider {

thread::Builder::new()
.name(thread_name)
.spawn(move || Self::event_loop(policy))?;
.spawn(move || Self::event_loop(policy).unwrap())?;

Ok(freqs)
}
Expand Down

0 comments on commit 89463bf

Please sign in to comment.