diff options
author | Luc Provoost <luc.provoost@intel.com> | 2021-04-12 18:18:30 +0200 |
---|---|---|
committer | Luc Provoost <luc.provoost@intel.com> | 2021-04-12 21:04:44 +0200 |
commit | e6b54f87766cead3df1f1f5b7099ac6562f6096a (patch) | |
tree | 3de6fe4fb5de1a275471b482a76ed3d24ea022a1 /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py | |
parent | 9efb0fe5411cd3cd4eb7b8a6dbf2645ed18dbd1d (diff) |
Code improvements
Rework of some of the code for better readability
Change-Id: I559e88faba31d93e593d39cf436f3e114ba4528a
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py')
-rw-r--r-- | VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py index 8dfdc805..ee9ed792 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py @@ -58,30 +58,38 @@ class ImpairTest(RapidTest): sys.stdout.flush() time.sleep(1) # Get statistics now that the generation is stable and NO ARP messages any more - pps_req_tx,pps_tx,pps_sut_tx,pps_rx,lat_avg, lat_perc, lat_perc_max, lat_max, abs_tx, abs_rx, abs_dropped, abs_tx_fail, drop_rate, lat_min, lat_used, r, actual_duration, _,bucket_size, buckets = self.run_iteration(float(self.test['runtime']),flow_number,size,speed) + iteration_data = self.run_iteration(float(self.test['runtime']),flow_number,size,speed) + iteration_data['speed'] = speed # Drop rate is expressed in percentage. lat_used is a ratio (0 to 1). The sum of these 2 should be 100%. # If the sum is lower than 95, it means that more than 5% of the latency measurements where dropped for accuracy reasons. - if (drop_rate + lat_used * 100) < 95: - lat_warning = bcolors.WARNING + ' Latency accuracy issue?: {:>3.0f}%'.format(lat_used*100) + bcolors.ENDC + if (iteration_data['drop_rate'] + iteration_data['lat_used'] * 100) < 95: + lat_warning = bcolors.WARNING + ' Latency accuracy issue?: {:>3.0f}%'.format(iteration_data['lat_used']*100) + bcolors.ENDC else: lat_warning = '' - RapidLog.info(self.report_result(attempts,size,speed,pps_req_tx,pps_tx,pps_sut_tx,pps_rx,lat_avg,lat_perc,lat_perc_max,lat_max,abs_tx,abs_rx,abs_dropped,actual_duration)) + iteration_prefix = {'speed' : '', + 'lat_avg' : '', + 'lat_perc' : '', + 'lat_max' : '', + 'abs_drop_rate' : '', + 'drop_rate' : ''} + RapidLog.info(self.report_result(attempts, size, iteration_data, + iteration_prefix)) result_details = {'test': self.test['test'], 'environment_file': self.test['environment_file'], 'Flows': flow_number, 'Size': size, 'RequestedSpeed': RapidTest.get_pps(speed,size), - 'CoreGenerated': pps_req_tx, - 'SentByNIC': pps_tx, - 'FwdBySUT': pps_sut_tx, - 'RevByCore': pps_rx, - 'AvgLatency': lat_avg, - 'PCTLatency': lat_perc, - 'MaxLatency': lat_max, - 'PacketsLost': abs_dropped, - 'DropRate': drop_rate, - 'bucket_size': bucket_size, - 'buckets': buckets} + 'CoreGenerated': iteration_data['pps_req_tx'], + 'SentByNIC': iteration_data['pps_tx'], + 'FwdBySUT': iteration_data['pps_sut_tx'], + 'RevByCore': iteration_data['pps_rx'], + 'AvgLatency': iteration_data['lat_avg'], + 'PCTLatency': iteration_data['lat_perc'], + 'MaxLatency': iteration_data['lat_max'], + 'PacketsLost': iteration_data['abs_dropped'], + 'DropRate': iteration_data['drop_rate'], + 'bucket_size': iteration_data['bucket_size'], + 'buckets': iteration_data['buckets']} result_details = self.post_data('rapid_impairtest', result_details) self.gen_machine.stop_latency_cores() return (True, result_details) |