diff options
author | iximeow <me@iximeow.net> | 2023-07-04 15:05:23 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-07-04 15:05:23 -0700 |
commit | c32adfb1956f89f7f778edce9e0367086080b058 (patch) | |
tree | 16c51faa2b32f5a716269cb590cac4bc6fb6f0d9 | |
parent | ca1ac8aec85e356377e554e6ad28142ff2e65c6e (diff) |
parse cpu MHz from /proc/cpuinfo correctly
-rw-r--r-- | src/ci_runner.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ci_runner.rs b/src/ci_runner.rs index 63dc74e..9aaf33d 100644 --- a/src/ci_runner.rs +++ b/src/ci_runner.rs @@ -556,7 +556,10 @@ mod host_info { let cpu_mhzes: Vec<&String> = cpu_lines.iter().filter(|line| line.starts_with("cpu MHz")).collect(); match cpu_mhzes.get(cpu as usize) { Some(mhz) => { - let mhz: f64 = cpu_mhzes[cpu as usize].trim().parse().unwrap(); + let mut line_parts = cpu_mhzes[cpu as usize].split(":"); + let _ = line_parts.next(); + let mhz = line_parts.next().unwrap().trim(); + let mhz: f64 = mhz.parse().unwrap(); Ok((mhz * 1000.0) as u64) }, None => { |