summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-05-29 11:00:37 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-05-29 11:00:37 +0300
commit1df2f7b5b63c16955ea0bde6cc8e524e31ed0b79 (patch)
treea78519f2c230aed346fde0217587a865c2283198 /scripts/automation/trex_control_plane
parentb0b3908b1b3742b84b48298fb8f7524e422bb28d (diff)
Fix for broken latency example
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_flow_latency_stats.py9
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py10
2 files changed, 13 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_flow_latency_stats.py b/scripts/automation/trex_control_plane/stl/examples/stl_flow_latency_stats.py
index df0605bf..86b91728 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_flow_latency_stats.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_flow_latency_stats.py
@@ -96,14 +96,15 @@ def rx_iteration (c, tx_port, rx_port, total_pkts, pkt_len, bw):
print(" Average latency(usec): {0}".format(avg))
print(" Jitter(usec): {0}".format(jitter))
print(" Latency distribution histogram:")
- hist.sort()
- for sample in hist:
- range_start = sample['key']
+ l = hist.keys()
+ l.sort()
+ for sample in l:
+ range_start = sample
if range_start == 0:
range_end = 10
else:
range_end = range_start + pow(10, (len(str(range_start))-1))
- val = sample['val']
+ val = hist[sample]
print (" Packets with latency between {0} and {1}:{2} ".format(range_start, range_end, val))
if tx_pkts != total_pkts:
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 6b34b11a..ee4bd1f9 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
@@ -1026,9 +1026,15 @@ class CLatencyStats(CTRexStats):
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'] = {elem['key']: elem['val'] for elem in current_pg['latency']['h']['histogram']}
+ output[int_pg_id]['latency']['histogram'] = {elem['key']: elem['val']
+ for elem in current_pg['latency']['h']['histogram']}
zero_count = current_pg['latency']['h']['cnt'] - current_pg['latency']['h']['high_cnt']
- output[int_pg_id]['latency']['histogram'][0] = zero_count
+ if zero_count != 0:
+ output[int_pg_id]['latency']['total_min'] = 1
+ output[int_pg_id]['latency']['histogram'][0] = zero_count
+ else:
+ output[int_pg_id]['latency']['total_min'] = min(output[int_pg_id]['latency']['histogram'].keys())
+
self.latest_stats = output
return True