Conversation
Set the IEC_UNITS flag separately for the value but refrain using it for the unit string. Memory sizes unit strings are always shown without the lowercase letter I eg. "MB" or "GB" instead of "MiB" or "GiB". Rationale for this commit is to not have your average user wonder what that lowercase letter I depicts.
Also update util memory size format function to: - show the full format with single decimal place eg. "3.1 MB" unless, - the size is an exact factor/power of 2 then show eg. "32 GB". This is to show accurate total physical memory available eg. "32 GB" instead of previously showing "31.2 GiB" which libgtop would report.
|
Could you resolve the conflicts? |
@ryonakano done! |
ryonakano
left a comment
There was a problem hiding this comment.
I wonder whether you combined two changes into one PR; if so you should separate this PR into two.
| total = (double) (mem.total); | ||
| var total_physical_memory = get_total_physical_memory (); | ||
| total = (double) (total_physical_memory > 0 ? total_physical_memory : mem.total); |
There was a problem hiding this comment.
Am I understand correctly that you used GUdev to get "accurate total physical available memory size"? Could you tell me the differences of values between GTop and GUdev?
There was a problem hiding this comment.
GUDev code gets you the actual installed physical memory size, meaning if your computer has 16 GiB it will get this exact number in bytes.
GTop on the other hand returns the "user accessible" memory size which is lower than what GUDev returns due to things like memory being reserved for kernel buffer cache, iGPU memory etc.
The switch from using GTop (still remains as fallback) to GUDev is shown in the before-after screenshots where you can see the "total memory" is lower with GTop used before.
| ); | ||
| } | ||
|
|
||
| public static string format_memory_size (uint64 size_in_bytes) { |
There was a problem hiding this comment.
Could you leave some comments for what you're doing in this method?
There was a problem hiding this comment.
@ryonakano added comments in efd0235 hope the wording makes for a sensible explanation?
I feel these changes are closely related, it might just be a nitpick to separate them into two PRs. |
Especially the adjustment for unit/value mismatch fix in 81392c9
Observe the screenshots where before it would show eg. total memory as "125.4 GiB" and other memory size units in IEC format eg. "MiB" with the lowercase letter I.
This PR proposes a more user-friendly format to always show the units eg. "MB" or "GB" and if the size is an exact factor/power of 2 then exclude the decimal place eg. "128 GB" instead of "128.0 GB" otherwise show eg. "3.1 MB".
This is similar to elementary/settings-system#251 and elementary/settings-system#252 which can be considered prior art.
BEFORE:

AFTER:
