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

Linux memory usage parsing seems to use the wrong unit #341

Open
ClementTsang opened this issue Jul 15, 2021 · 0 comments · May be fixed by #348
Open

Linux memory usage parsing seems to use the wrong unit #341

ClementTsang opened this issue Jul 15, 2021 · 0 comments · May be fixed by #348

Comments

@ClementTsang
Copy link

ClementTsang commented Jul 15, 2021

Was looking through the meminfo parsing code and noticed that at here, the strings in /proc/meminfo are parsed as kilobytes:

Information::new::<information::kilobyte>(value)

However, as far as I understand it, it seems like this the wrong unit - this Red Hat doc states:

While the file shows kilobytes (kB; 1 kB equals 1000 B), it is actually kibibytes (KiB; 1 KiB equals 1024 B). This imprecision in /proc/meminfo is known, but is not corrected due to legacy concerns - programs rely on /proc/meminfo to specify size with the "kB" string.

So if I'm understanding this correctly, it's probably better to switch it to

Information::new::<information::kibibyte>(value)

as otherwise users may get values that are slightly inaccurate if they aren't aware.

@ClementTsang ClementTsang changed the title Linux memory usage parsing doesn't seem to be correct Linux memory usage parsing seems to use the wrong unit Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant