diff --git a/mem/mem.go b/mem/mem.go index edaf268bb..9402d27be 100644 --- a/mem/mem.go +++ b/mem/mem.go @@ -80,6 +80,11 @@ type VirtualMemoryStat struct { HugePagesSurp uint64 `json:"hugePagesSurp"` HugePageSize uint64 `json:"hugePageSize"` AnonHugePages uint64 `json:"anonHugePages"` + + // Windows specific numbers + // https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex + VirtualTotal uint64 `json:"virtualTotal"` + VirtualAvail uint64 `json:"virtualAvail"` } type SwapMemoryStat struct { diff --git a/mem/mem_windows.go b/mem/mem_windows.go index 8c7fb1a13..c541ce084 100644 --- a/mem/mem_windows.go +++ b/mem/mem_windows.go @@ -45,10 +45,12 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { } ret := &VirtualMemoryStat{ - Total: memInfo.ullTotalPhys, - Available: memInfo.ullAvailPhys, - Free: memInfo.ullAvailPhys, - UsedPercent: float64(memInfo.dwMemoryLoad), + Total: memInfo.ullTotalPhys, + Available: memInfo.ullAvailPhys, + Free: memInfo.ullAvailPhys, + UsedPercent: float64(memInfo.dwMemoryLoad), + VirtualTotal: memInfo.ullTotalVirtual, + VirtualAvail: memInfo.ullAvailVirtual, } ret.Used = ret.Total - ret.Available