diff options
author | 2016-05-17 02:55:54 +0300 | |
---|---|---|
committer | 2016-05-18 19:23:47 +0300 | |
commit | 3e024d8bdcebdd3100851f28b5724a2ecbfc923a (patch) | |
tree | 08c62dc02a86845f1d2ba643bd5fdb85860e79ce /scripts/automation/trex_control_plane/stl/trex_stl_lib/utils | |
parent | 9ba34d62a9faed8fb782062c58c3d746ce56a107 (diff) |
add latency panel to TUI
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py index 7e0bf9e4..72be7c29 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py @@ -36,11 +36,18 @@ def format_num (size, suffix = "", compact = True, opts = ()): u = '' if compact: - for unit in ['','K','M','G','T','P']: - if abs(size) < 1000.0: - u = unit - break - size /= 1000.0 + if 0 < abs(size) < 1: + for unit in ['m','u','n','p']: + size *= 1000 + if abs(size) >= 1: + u = unit + break + else: + for unit in ['','K','M','G','T','P']: + if abs(size) < 1000.0: + u = unit + break + size /= 1000.0 if isinstance(size, float): txt = "%3.2f" % (size) |