From bae48d6cf8dd59158ffcb488391af8a96fc2e037 Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 14 Dec 2015 04:47:35 -0500 Subject: TUI v2.0 - now no flickering, state machine for lost of connectivity and TUI can be started in xterm using tui -x --- scripts/automation/trex_control_plane/common/trex_stats.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/automation/trex_control_plane/common') diff --git a/scripts/automation/trex_control_plane/common/trex_stats.py b/scripts/automation/trex_control_plane/common/trex_stats.py index 2f6ea38d..20255f41 100755 --- a/scripts/automation/trex_control_plane/common/trex_stats.py +++ b/scripts/automation/trex_control_plane/common/trex_stats.py @@ -194,6 +194,9 @@ class CTRexStats(object): @staticmethod def format_num(size, suffix = ""): + if type(size) == str: + return "N/A" + for unit in ['','K','M','G','T','P']: if abs(size) < 1000.0: return "%3.2f %s%s" % (size, unit, suffix) @@ -219,6 +222,9 @@ class CTRexStats(object): def clear_stats(self): self.reference_stats = self.latest_stats + def invalidate (self): + self.latest_stats = {} + def get(self, field, format=False, suffix=""): if not field in self.latest_stats: return "N/A" -- cgit 1.2.3-korg