From cb4fc4381b85661658885c3c5f9e0bbcb1ce280a Mon Sep 17 00:00:00 2001 From: imarom Date: Sun, 13 Mar 2016 15:11:15 +0200 Subject: RX stats API/TUI refinement --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py | 11 +++++++++-- 1 file changed, 9 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 bb877586..12bf881a 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 @@ -828,8 +828,8 @@ class CRxStats(CTRexStats): # copy timestamp field output['ts'] = current['ts'] - # aggregate all the PG ids (previous and current) - pg_ids = filter(is_intable, set(prev.keys() + current.keys())) + # we care only about the current active keys + pg_ids = filter(is_intable, current.keys()) for pg_id in pg_ids: @@ -854,6 +854,13 @@ class CRxStats(CTRexStats): self.calculate_bw_for_pg(output[pg_id], prev_pg, diff_sec) + # cleanp old reference values - they are dead + ref_pg_ids = filter(is_intable, self.reference_stats.keys()) + + deleted_pg_ids = set(ref_pg_ids).difference(pg_ids) + for d_pg_id in deleted_pg_ids: + del self.reference_stats[d_pg_id] + return output -- cgit 1.2.3-korg