From dac3a113cca91deb5bee0a3344448def7aeda755 Mon Sep 17 00:00:00 2001 From: one Date: Fri, 13 Feb 2026 14:15:30 +0800 Subject: [PATCH 1/3] fix: accumulate pwr_usage into pwr_total instead of mem_total in Gpu::collect() --- src/linux/btop_collect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 8c3a8ba..2d005a4 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -2018,7 +2018,7 @@ namespace Gpu { if (gpu.supported_functions.mem_total) mem_total += gpu.mem_total; if (gpu.supported_functions.pwr_usage) - mem_total += gpu.pwr_usage; + pwr_total += gpu.pwr_usage; //* Trim vectors if there are more values than needed for graphs if (width != 0) { From 2899c58118550dc8457b9ad80c5c1385835142ac Mon Sep 17 00:00:00 2001 From: one Date: Sat, 28 Feb 2026 19:12:19 +0800 Subject: [PATCH 2/3] fix: correct shared gpu vram and power percentage calculations --- 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 2d005a4..ce98ecb 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -2036,9 +2036,9 @@ namespace Gpu { shared_gpu_percent.at("gpu-average").push_back(avg / gpus.size()); if (mem_total != 0) - shared_gpu_percent.at("gpu-vram-total").push_back(mem_usage_total / mem_total); + shared_gpu_percent.at("gpu-vram-total").push_back((long long)round((double)mem_usage_total * 100.0 / (double)mem_total)); if (gpu_pwr_total_max != 0) - shared_gpu_percent.at("gpu-pwr-total").push_back(pwr_total / gpu_pwr_total_max); + shared_gpu_percent.at("gpu-pwr-total").push_back(clamp((long long)round((double)pwr_total * 100.0 / (double)gpu_pwr_total_max), 0ll, 100ll)); if (width != 0) { while (cmp_greater(shared_gpu_percent.at("gpu-average").size(), width * 2)) shared_gpu_percent.at("gpu-average").pop_front(); From 92cf853cdb6955a1e9a366a8f3217dcbb931d1fc Mon Sep 17 00:00:00 2001 From: one Date: Mon, 2 Mar 2026 09:35:04 +0800 Subject: [PATCH 3/3] fix: use static_cast --- 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 ce98ecb..e7c360a 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -2036,9 +2036,9 @@ namespace Gpu { shared_gpu_percent.at("gpu-average").push_back(avg / gpus.size()); if (mem_total != 0) - shared_gpu_percent.at("gpu-vram-total").push_back((long long)round((double)mem_usage_total * 100.0 / (double)mem_total)); + shared_gpu_percent.at("gpu-vram-total").push_back(static_cast(round(mem_usage_total * 100.0 / mem_total))); if (gpu_pwr_total_max != 0) - shared_gpu_percent.at("gpu-pwr-total").push_back(clamp((long long)round((double)pwr_total * 100.0 / (double)gpu_pwr_total_max), 0ll, 100ll)); + shared_gpu_percent.at("gpu-pwr-total").push_back(clamp(static_cast(round(pwr_total * 100.0 / gpu_pwr_total_max)), 0ll, 100ll)); if (width != 0) { while (cmp_greater(shared_gpu_percent.at("gpu-average").size(), width * 2)) shared_gpu_percent.at("gpu-average").pop_front();