Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing precision for virtual memory used percent on windows #1619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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