Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0331-observer-correct-the-units-shown-for-memor...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0331-observer-correct-the-units-shown-for-memory-data.patch of Package erlang
From 3ad1465a2c9214136a2c37f3eb8912ac82c7a7d9 Mon Sep 17 00:00:00 2001 From: Gonzalo Bella <gonzalobfmp@gmail.com> Date: Wed, 8 Jun 2022 19:21:17 +0100 Subject: [PATCH] observer: correct the units shown for memory data The current code does the conversion from bytes to kibibyte (KiB), mebibyte(MiB) and gibibyte(GiB), that is dividing by 1024. However, when the units are printed, the units are in kilobytes (KB), megabytes (MB) and gigabytes (GB). This commit changes the unit printed to KiB, MiB and GiB. --- lib/observer/src/observer_lib.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl index b4c2663d0d..b06f645688 100644 --- a/lib/observer/src/observer_lib.erl +++ b/lib/observer/src/observer_lib.erl @@ -299,13 +299,13 @@ to_str({Unit, X}) when (Unit==bytes orelse Unit==time_ms) andalso is_list(X) -> catch error:badarg -> X end; to_str({bytes, B}) -> - KB = B div 1024, - MB = KB div 1024, - GB = MB div 1024, + KiB = B div 1024, + MiB = KiB div 1024, + GiB = MiB div 1024, if - GB > 10 -> integer_to_list(GB) ++ " GB"; - MB > 10 -> integer_to_list(MB) ++ " MB"; - KB > 0 -> integer_to_list(KB) ++ " kB"; + GiB > 10 -> integer_to_list(GiB) ++ " GiB"; + MiB > 10 -> integer_to_list(MiB) ++ " MiB"; + KiB > 0 -> integer_to_list(KiB) ++ " KiB"; true -> integer_to_list(B) ++ " B" end; to_str({{words,WSz}, Sz}) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor