From c32adfb1956f89f7f778edce9e0367086080b058 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 4 Jul 2023 15:05:23 -0700 Subject: parse cpu MHz from /proc/cpuinfo correctly --- src/ci_runner.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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 => { -- cgit v1.1