Skip to content

Conversation

@rayjanoka
Copy link

@rayjanoka rayjanoka commented Apr 4, 2024

Hey! Nice library!!

I found that the virtualMemory.UsedPercent returned by windows is just a whole number and we lose some precision there. I computed it instead using total - available / total * 100 so we can get the same precision we see on linux.

virtMemTest - Old 28.000000 : New 28.606437
virtMemTest - Old 28.000000 : New 28.594666
virtMemTest - Old 28.000000 : New 28.637374

@shirou
Copy link
Owner

shirou commented Apr 18, 2024

Good point. Thanks you for opening this PR.

However, I noticed that psutil uses PERFORMANCE_INFORMATION instead of MEMORYSTATUSEX. So I think we should change that. After the change, the precision issue will be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants