Move C-state name cleaning to agent for smaller JSON
All checks were successful
Build and Release / build-and-release (push) Successful in 1m32s

- Agent now extracts "C" + digits pattern (C3, C10) using char parsing
- Removes suffixes like "_ACPI", "_MWAIT" at source
- Reduces JSON payload size over ZMQ
- No regex dependency - uses fast char iteration (~1μs overhead)
- Robust fallback to original name if pattern not found
- Dashboard simplified to use clean names directly

Bump version to v0.1.212

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 14:05:55 +01:00
parent 0d8284b69c
commit 5e08b34280
6 changed files with 23 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "cm-dashboard"
version = "0.1.211"
version = "0.1.212"
edition = "2021"
[dependencies]

View File

@@ -144,13 +144,10 @@ impl SystemWidget {
}
// Format top 3 C-states with percentages: "C10:79% C8:10% C6:8%"
// Strip suffixes like "_ACPI" from state names
// Agent already sends clean names (C3, C10, etc.)
self.cpu_cstates
.iter()
.map(|cs| {
let clean_name = cs.name.split('_').next().unwrap_or(&cs.name);
format!("{}:{:.0}%", clean_name, cs.percent)
})
.map(|cs| format!("{}:{:.0}%", cs.name, cs.percent))
.collect::<Vec<_>>()
.join(" ")
}