summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stf
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-26 05:32:09 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-26 05:32:09 +0300
commitcb55f42f183e631aec06ecb7d1ad953ad71b57d2 (patch)
tree222080b9482e7518faf17a92552b661fd90f3896 /scripts/automation/trex_control_plane/stf
parent3d54c567d7bf2f75295e57cf8f903a7bf163b698 (diff)
stateful api: fix filter max latency
regression: fix bw_per_core at trex09 based on regression
Diffstat (limited to 'scripts/automation/trex_control_plane/stf')
-rwxr-xr-xscripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
index f5887120..7f241620 100755
--- a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
+++ b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
@@ -1289,26 +1289,24 @@ class CTRexResult(object):
def __get_filtered_max_latency (src_dict, filtered_latency_amount = 0.001):
result = {}
for port, data in src_dict.items():
- if port.startswith('port-'):
- max_port = 'max-%s' % port[5:]
- res = data['hist']
- if not len(res['histogram']):
- result[max_port] = 0
- continue
- hist_last_keys = deque([res['histogram'][-1]['key']], maxlen = 2)
- sum_high = 0.0
- for elem in reversed(res['histogram']):
- sum_high += elem['val']
- hist_last_keys.append(elem['key'])
- if sum_high >= filtered_latency_amount * res['cnt']:
- break
- result[max_port] = (hist_last_keys[0] + hist_last_keys[-1]) / 2
- else:
- return {}
+ if not port.startswith('port-'):
+ continue
+ max_port = 'max-%s' % port[5:]
+ res = data['hist']
+ if not len(res['histogram']):
+ result[max_port] = 0
+ continue
+ sum_high = 0.0
+ for elem in reversed(res['histogram']):
+ sum_high += elem['val']
+ if sum_high >= filtered_latency_amount * res['cnt']:
+ result[max_port] = elem['key'] + int('5' + repr(elem['key'])[2:])
+ break
return result
+
if __name__ == "__main__":
pass