From 87778474d93682c1602dbca77f982e91b42c072c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20H=C3=A9rault?= Date: Wed, 1 Jul 2026 13:13:49 +0200 Subject: [PATCH 1/2] removing excess frequency value --- crates/lib/src/cpu.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/lib/src/cpu.rs b/crates/lib/src/cpu.rs index 479451d..1e14b9d 100644 --- a/crates/lib/src/cpu.rs +++ b/crates/lib/src/cpu.rs @@ -340,7 +340,12 @@ fn extract_field<'a>(data: &'a [u8], key: &[u8]) -> Option<&'a str> { while p < line.len() && line[p] == b' ' { p += 1; } - return core::str::from_utf8(&line[p..]).ok(); + //remove the frequency in model name as its resolved later + let mut hz = p+1; + while hz < line.len() && line[hz] != b'@' { + hz += 1; + } + return core::str::from_utf8(&line[p..hz-1]).ok(); } } From 7a2d46a774e502d602a2548995d292e500aa14b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20H=C3=A9rault?= Date: Wed, 15 Jul 2026 11:13:59 +0200 Subject: [PATCH 2/2] using code comment to resolve the discussion --- crates/lib/src/cpu.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/lib/src/cpu.rs b/crates/lib/src/cpu.rs index 1e14b9d..889c8ae 100644 --- a/crates/lib/src/cpu.rs +++ b/crates/lib/src/cpu.rs @@ -255,6 +255,10 @@ fn get_model_name() -> Option { let base = extract_name(data)?; let mut name = base; if let Some(mhz) = get_cpu_freq_mhz() { + if let Some(at) = name.find(" @ ") { + name.truncate(at); + } + name.push_str(" @ "); // Round to nearest 0.01 GHz, then split so carries (e.g. 1999 MHz) // roll into the integer part instead of overflowing the fraction. @@ -340,12 +344,7 @@ fn extract_field<'a>(data: &'a [u8], key: &[u8]) -> Option<&'a str> { while p < line.len() && line[p] == b' ' { p += 1; } - //remove the frequency in model name as its resolved later - let mut hz = p+1; - while hz < line.len() && line[hz] != b'@' { - hz += 1; - } - return core::str::from_utf8(&line[p..hz-1]).ok(); + return core::str::from_utf8(&line[p..]).ok(); } }