summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/common
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-21 10:05:18 -0500
committerimarom <imarom@cisco.com>2016-01-21 10:11:56 -0500
commitcc75f3f75e026bc17e526577c463ab5b524ebf22 (patch)
tree4bb36e777bbed90586cfb1a4ae08b29f63f51146 /scripts/automation/trex_control_plane/common
parentb726b5682fca2b1e032380401457d1afb47e1713 (diff)
phase 4
Diffstat (limited to 'scripts/automation/trex_control_plane/common')
-rwxr-xr-xscripts/automation/trex_control_plane/common/trex_stats.py45
1 files changed, 41 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/common/trex_stats.py b/scripts/automation/trex_control_plane/common/trex_stats.py
index 3d6ece7c..9c2cd7f1 100755
--- a/scripts/automation/trex_control_plane/common/trex_stats.py
+++ b/scripts/automation/trex_control_plane/common/trex_stats.py
@@ -260,7 +260,7 @@ class CTRexStats(object):
def __init__(self):
self.reference_stats = None
- self.latest_stats = {}
+ self.latest_stats = None
self.last_update_ts = time.time()
self.history = deque(maxlen = 10)
@@ -314,13 +314,11 @@ class CTRexStats(object):
self.last_update_ts = time.time()
- def get_stats (self):
- # copy and return
- return dict(self.latest_stats)
def clear_stats(self):
self.reference_stats = self.latest_stats
+
def invalidate (self):
self.latest_stats = {}
@@ -337,6 +335,10 @@ class CTRexStats(object):
return "N/A"
if not format:
+ if not field in self.reference_stats:
+ print "REF: " + str(self.reference_stats)
+ print "BASE: " + str(self.latest_stats)
+
return (self.latest_stats[field] - self.reference_stats[field])
else:
return format_num(self.latest_stats[field] - self.reference_stats[field], suffix)
@@ -403,6 +405,24 @@ class CGlobalStats(CTRexStats):
self.server_version = server_version
self._ports_dict = ports_dict_ref
+ def get_stats (self):
+ stats = {}
+
+ # absolute
+ stats['cpu_util'] = self.get("m_cpu_util")
+ stats['tx_bps'] = self.get("m_tx_bps")
+ stats['tx_pps'] = self.get("m_tx_pps")
+
+ stats['rx_bps'] = self.get("m_rx_bps")
+ stats['rx_pps'] = self.get("m_rx_pps")
+ stats['rx_drop_bps'] = self.get("m_rx_drop_bps")
+
+ # relatives
+ stats['queue_full'] = self.get_rel("m_total_queue_full")
+
+ return stats
+
+
def generate_stats(self):
return OrderedDict([("connection", "{host}, Port {port}".format(host=self.connection_info.get("server"),
port=self.connection_info.get("sync_port"))),
@@ -475,6 +495,23 @@ class CPortStats(CTRexStats):
return self
+ # for port we need to do something smarter
+ def get_stats (self):
+ stats = {}
+
+ stats['opackets'] = self.get_rel("opackets")
+ stats['ipackets'] = self.get_rel("ipackets")
+ stats['obytes'] = self.get_rel("obytes")
+ stats['ibytes'] = self.get_rel("ibytes")
+ stats['oerrors'] = self.get_rel("oerrors")
+ stats['ierrors'] = self.get_rel("ierrors")
+ stats['tx_bps'] = self.get("m_total_tx_bps")
+ stats['tx_pps'] = self.get("m_total_tx_pps")
+ stats['rx_bps'] = self.get("m_total_rx_bps")
+ stats['rx_pps'] = self.get("m_total_rx_pps")
+
+ return stats
+
def generate_stats(self):