From 0eb8e63fe95a15fe26df36f1f5efe00b5b9ea30c Mon Sep 17 00:00:00 2001 From: "ray.janoka" <{ID}+{username}@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:35:54 -0600 Subject: [PATCH] increasing precision for virtual memory used percent --- mem/mem_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mem/mem_windows.go b/mem/mem_windows.go index 8c7fb1a13..e12fe54d7 100644 --- a/mem/mem_windows.go +++ b/mem/mem_windows.go @@ -48,7 +48,7 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { Total: memInfo.ullTotalPhys, Available: memInfo.ullAvailPhys, Free: memInfo.ullAvailPhys, - UsedPercent: float64(memInfo.dwMemoryLoad), + UsedPercent: float64(memInfo.ullTotalPhys-memInfo.ullAvailPhys) / float64(memInfo.ullTotalPhys) * 100, } ret.Used = ret.Total - ret.Available