From 05782a2fc2b8ae342e8981125c4164ba2506f81b Mon Sep 17 00:00:00 2001 From: snowy-yang <102860110+snowy-yang@users.noreply.github.com> Date: Sat, 12 Sep 2026 14:27:24 +0800 Subject: [PATCH] feat: show Linux-style total CPU usage (sum of cores, can exceed 100%) --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 4f298d2..e5c31bb 100644 --- a/bot.py +++ b/bot.py @@ -48,7 +48,10 @@ def fmt_status(s: dict) -> str: power_str = f"{p['total_watts']}W [{src}]{extra}" lines.append(f"⚡ 功耗: {power_str}") 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']}%") if s["temps"]: flat = [t for entries in s["temps"].values() for t in entries]