SwapMemory on windows was incorrect. This PR change SwapMemory to adjust psutil implementation. It is a method of calculating the actual value by using the Paging File(_Total)% Usage from the Performance Counter to determine the value.
Note: This PR will significantly change the value of SwapMemory on windows.
PS gopsutil\mem> go test -run TestSwapMemory -v
=== RUN TestSwapMemory
mem_test.go:81: {"total":32110739456,"used":17000914944,"free":15109824512,"usedPercent":52.944638560241316,"sin":0,"sout":0,"pgIn":0,"pgOut":0,"pgFault":0,"pgMajFault":0}
After
PS gopsutil\mem> go test -run TestSwapMemory -v
=== RUN TestSwapMemory
mem_test.go:81: {"total":15569256448,"used":119250944,"free":15450005504,"usedPercent":0.8,"sin":0,"sout":0,"pgIn":0,"pgOut":0,"pgFault":0,"pgMajFault":0}
Fixes: #1511
SwapMemory on windows was incorrect. This PR change
SwapMemory
to adjust psutil implementation. It is a method of calculating the actual value by using thePaging File(_Total)% Usage
from thePerformance Counter
to determine the value.Note: This PR will significantly change the value of
SwapMemory
on windows.psutil
Before
After