diff options
author | imarom <imarom@cisco.com> | 2016-01-24 08:27:22 -0500 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-01-24 08:28:19 -0500 |
commit | 7294d7f162e19e0ccd3a37eafbafe22cf63df6a4 (patch) | |
tree | 69300aec21fbd1fd6dd93c0ada94fdf4137dfdc5 /scripts/automation/trex_control_plane/common/text_opts.py | |
parent | 42160bad7056d26b6f5b8c42efc0a8bf5302dfef (diff) |
fixed issue trex-172: Console -m 100% is L2 and no L1
http://trex-tgn.cisco.com/youtrack/issue/trex-172
Diffstat (limited to 'scripts/automation/trex_control_plane/common/text_opts.py')
-rwxr-xr-x | scripts/automation/trex_control_plane/common/text_opts.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/common/text_opts.py b/scripts/automation/trex_control_plane/common/text_opts.py index 30d38d3f..78a0ab1f 100755 --- a/scripts/automation/trex_control_plane/common/text_opts.py +++ b/scripts/automation/trex_control_plane/common/text_opts.py @@ -38,15 +38,17 @@ def format_num (size, suffix = "", compact = True, opts = ()): if compact: for unit in ['','K','M','G','T','P']: if abs(size) < 1000.0: - #txt = "%3.2f %s%s" % (size, unit, suffix) u = unit break size /= 1000.0 if isinstance(size, float): - txt = "%3.2f %s%s" % (size, u, suffix) + txt = "%3.2f" % (size) else: - txt = "{:,} {:}{:}".format(size, u, suffix) + txt = "{:,}".format(size) + + if u or suffix: + txt += " {:}{:}".format(u, suffix) if isinstance(opts, tuple): return format_text(txt, *opts) |