summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-05-18 16:53:42 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-05-18 19:23:58 +0300
commitcc2abc13f1f74612b211d3cd235341745b16bd49 (patch)
treea35f5b0e0f9388d4be5ca25337fa6dbef2c0d8a9 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
parent91120a37444f8a2f5e1d676f9a091f54346a3cfd (diff)
Change to latency python + small fixes
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.py16
1 files changed, 13 insertions, 3 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 e1100b17..7c5a23cb 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
@@ -868,7 +868,8 @@ class CLatencyStats(CTRexStats):
# for API
def get_stats (self):
- return self.latest_stats
+ ret = copy.deepcopy(self.latest_stats)
+ return ret
def _update(self, snapshot):
@@ -884,8 +885,17 @@ class CLatencyStats(CTRexStats):
current_pg = snapshot.get(pg_id)
int_pg_id = int(pg_id)
output[int_pg_id] = {}
- for field in ['err_cntrs', 'latency']:
- output[int_pg_id][field] = current_pg[field]
+ output[int_pg_id]['err_cntrs'] = current_pg['err_cntrs']
+ output[int_pg_id]['latency'] = {}
+
+ output[int_pg_id]['latency']['last_max'] = current_pg['latency']['last_max']
+ output[int_pg_id]['latency']['jitter'] = current_pg['latency']['jitter']
+ if current_pg['latency']['h'] != "":
+ output[int_pg_id]['latency']['average'] = current_pg['latency']['h']['s_avg']
+ output[int_pg_id]['latency']['total_max'] = current_pg['latency']['h']['max_usec']
+ output[int_pg_id]['latency']['histogram'] = current_pg['latency']['h']['histogram']
+ zero_count = current_pg['latency']['h']['cnt'] - current_pg['latency']['h']['high_cnt']
+ output[int_pg_id]['latency']['histogram'].append({'key':0, 'val':zero_count})
self.latest_stats = output
return True