summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-05-09 17:00:24 +0300
committerimarom <imarom@cisco.com>2016-05-09 17:00:24 +0300
commitf2b38a3de49bd73ac1c29103c9c3305b18222c6a (patch)
tree3d8dd3b5cdb2812311fec51611d256108981b082
parent3ef23bf8bf6b9f9bb59de4289658f3f81da63435 (diff)
small fix for TUI (shows CPU util. in round up float)
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
index c7513144..61122e79 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
@@ -28,6 +28,9 @@ SS_COMPAT = [GLOBAL_STATS, STREAMS_STATS]
ExportableStats = namedtuple('ExportableStats', ['raw_data', 'text_table'])
+def round_float (f):
+ return float("%.2f" % f)
+
# deep mrege of dicts dst = src + dst
def deep_merge_dicts (dst, src):
for k, v in src.items():
@@ -633,10 +636,10 @@ class CGlobalStats(CTRexStats):
("version", "{ver}, UUID: {uuid}".format(ver=self.server_version.get("version", "N/A"),
uuid="N/A")),
- ("cpu_util", "{0}% {1}".format( format_threshold(self.get("m_cpu_util"), [85, 100], [0, 85]),
+ ("cpu_util", "{0}% {1}".format( format_threshold(round_float(self.get("m_cpu_util")), [85, 100], [0, 85]),
self.get_trend_gui("m_cpu_util", use_raw = True))),
- ("rx_cpu_util", "{0}% {1}".format( format_threshold(self.get("m_rx_cpu_util"), [85, 100], [0, 85]),
+ ("rx_cpu_util", "{0}% {1}".format( format_threshold(round_float(self.get("m_rx_cpu_util")), [85, 100], [0, 85]),
self.get_trend_gui("m_rx_cpu_util", use_raw = True))),
(" ", ""),