Merge lp:~roadmr/checkbox/1185508-memory-compare-units into lp:checkbox
Proposed by
Daniel Manrique
Status: | Merged |
---|---|
Approved by: | Zygmunt Krynicki |
Approved revision: | 3245 |
Merged at revision: | 3258 |
Proposed branch: | lp:~roadmr/checkbox/1185508-memory-compare-units |
Merge into: | lp:checkbox |
Diff against target: |
85 lines (+40/-8) 1 file modified
providers/plainbox-provider-checkbox/bin/memory_compare (+40/-8) |
To merge this branch: | bzr merge lp:~roadmr/checkbox/1185508-memory-compare-units |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zygmunt Krynicki (community) | Approve | ||
Review via email: mp+233282@code.launchpad.net |
Commit message
providers:checkbox: Improved memory size presentation in memory_compare.
Description of the change
providers:checkbox: Improved memory size presentation in memory_compare.
Sizes will always look like:
X.XX$UNIT
where UNIT can be bytes or QiB (where Q in turn is the appropriate metric prefix).
For instance:
456.00 bytes (the decimal number is redundant; if this is too ugly let me know and I can fix it, though it would balloon the dead-simple method to about twice its size :D)
7.56GiB
1023.99TiB (e.g. if I add 0.01 TiB here, it would become 1.00 PiB; also, if the quantity is already an integer I can remove the decimals, at the expense of more time and code).
To post a comment you must log in.
(venv)zyga@ silverblade: /ramdisk/ 1185508- memory- compare- units/providers /plainbox- provider- checkbox$ ./bin/memory_ compare memory_ compare" , line 92, in bytes_to_human
Results:
/proc/meminfo reports: 15.37GiB
lshw reports: 15.37GiB
Traceback (most recent call last):
File "./bin/
exponent = log(my_bytes, 1024)
ValueError: math domain error
During handling of the above exception, another exception occurred:
Traceback (most recent call last): memory_ compare" , line 140, in <module> exit(main( )) memory_ compare" , line 125, in main to_human( difference) , percentage, threshold)) memory_ compare" , line 94, in bytes_to_human my_bytes, exc))
File "./bin/
sys.
File "./bin/
"%d%% variance allowed." % (bytes_
File "./bin/
raise ValueError("cannot compute base-1024 logarithm of {!r}: {}".format(
ValueError: cannot compute base-1024 logarithm of 0: math domain error
Hmm?