summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py31
1 files changed, 31 insertions, 0 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 e30da00e..a65ef9e0 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
@@ -831,6 +831,37 @@ class CPortStats(CTRexStats):
}
+class CLatencyStats(CTRexStats):
+ def __init__(self, ports):
+ super(CLatencyStats, self).__init__()
+
+ # for API
+ def get_stats (self):
+ return self.latest_stats
+
+ def process_snapshot (self, current):
+ output = {}
+
+ # we care only about the current active keys
+ pg_ids = list(filter(is_intable, current.keys()))
+
+ for pg_id in pg_ids:
+ current_pg = current.get(pg_id)
+ int_pg_id = int(pg_id)
+ output[int_pg_id] = {}
+ for field in ['err_cntrs', 'jitter', 'latency']:
+ output[int_pg_id][field] = current_pg[field]
+ return output
+
+ def update (self, snapshot, baseline):
+ # generate a new snapshot
+ if (snapshot is not None):
+ new_snapshot = self.process_snapshot(snapshot)
+ else:
+ return
+
+ self.latest_stats = new_snapshot
+ return True
# RX stats objects - COMPLEX :-(