From af4a0c3e846acdbb11af4a02de3bfca2a299eb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Nov 2025 15:54:45 +0100 Subject: [PATCH] fix: cpu per-thread totals not reaching 100% (#1366) --- src/linux/btop_collect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index cc58b46..eebaa50 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -1102,7 +1102,7 @@ namespace Cpu { //? Calculate values for totals from first line of stat if (i == 0) { const long long calc_totals = max(1ll, totals - cpu_old.at("totals")); - const long long calc_idles = max(1ll, idles - cpu_old.at("idles")); + const long long calc_idles = max(0ll, idles - cpu_old.at("idles")); cpu_old.at("totals") = totals; cpu_old.at("idles") = idles; @@ -1133,7 +1133,7 @@ namespace Cpu { cpu.core_percent.emplace_back(); } const long long calc_totals = max(1ll, totals - core_old_totals.at(i-1)); - const long long calc_idles = max(1ll, idles - core_old_idles.at(i-1)); + const long long calc_idles = max(0ll, idles - core_old_idles.at(i-1)); core_old_totals.at(i-1) = totals; core_old_idles.at(i-1) = idles;