feat: show Linux-style total CPU usage (sum of cores, can exceed 100%)

This commit is contained in:
snowy-yang committed 2026-09-12 14:27:24 +08:00
1 parent f45df9b33f
commit 05782a2fc2
1 file changed
+4 -1
+4 -1
View File
@@ -48,7 +48,10 @@ def fmt_status(s: dict) -> str:
power_str = f"{p['total_watts']}W [{src}]{extra}" power_str = f"{p['total_watts']}W [{src}]{extra}"
lines.append(f"⚡ 功耗: {power_str}") lines.append(f"⚡ 功耗: {power_str}")
load = c["load"] load = c["load"]
lines.append(f"🖥 CPU: {c['percent']}% 核心 {c['cores']} 负载 {load[0]:.2f}/{load[1]:.2f}/{load[2]:.2f}") total_pct = sum(c["per_core"])
lines.append(f"🖥 CPU: {total_pct:.1f}% / {c['cores'] * 100}% "
f"(单核均值 {c['percent']}%) 核心 {c['cores']} "
f"负载 {load[0]:.2f}/{load[1]:.2f}/{load[2]:.2f}")
lines.append(f"💾 内存: {m['used_gb']}/{m['total_gb']}GB ({m['percent']}%) Swap {m['swap_percent']}%") lines.append(f"💾 内存: {m['used_gb']}/{m['total_gb']}GB ({m['percent']}%) Swap {m['swap_percent']}%")
if s["temps"]: if s["temps"]:
flat = [t for entries in s["temps"].values() for t in entries] flat = [t for entries in s["temps"].values() for t in entries]