diff options
author | 2016-04-23 23:50:32 +0300 | |
---|---|---|
committer | 2016-04-23 23:50:32 +0300 | |
commit | 22a3fc2b94f878000b9d38cd38dabca05440e7d1 (patch) | |
tree | 8952d48e627faf340dea9c77b709a81ee215f798 /scripts/automation/regression/stateful_tests | |
parent | 6dc9c07fda0508d46ddccdb6888bae844b78361b (diff) |
regression: correct the BW per core calculation
Diffstat (limited to 'scripts/automation/regression/stateful_tests')
3 files changed, 25 insertions, 21 deletions
diff --git a/scripts/automation/regression/stateful_tests/trex_general_test.py b/scripts/automation/regression/stateful_tests/trex_general_test.py index 2e5adc40..827df686 100755 --- a/scripts/automation/regression/stateful_tests/trex_general_test.py +++ b/scripts/automation/regression/stateful_tests/trex_general_test.py @@ -137,10 +137,10 @@ class CTRexGeneral_Test(unittest.TestCase): def check_CPU_benchmark (self, trex_res, err = 10, minimal_cpu = 30, maximal_cpu = 85): #cpu_util = float(trex_res.get_last_value("trex-global.data.m_cpu_util")) - cpu_util = sum([float(x) for x in trex_res.get_value_list("trex-global.data.m_cpu_util")[-4:-1]]) / 3 # mean of 3 values before last + cpu_util = sum(trex_res.get_value_list("trex-global.data.m_cpu_util")[-4:-1]) / 3.0 # mean of 3 values before last if '1G' in self.modes: - minimal_cpu /= 10 + minimal_cpu /= 10.0 if not self.is_virt_nics: if cpu_util > maximal_cpu: @@ -149,21 +149,19 @@ class CTRexGeneral_Test(unittest.TestCase): self.fail("CPU is too low (%s%%), can't verify performance in such low CPU%%." % cpu_util ) cores = self.get_benchmark_param('cores') - trex_tx_bps = trex_res.get_last_value("trex-global.data.m_total_tx_bytes") - test_norm_cpu = 100.0*(trex_tx_bps/(cores*cpu_util))/1e6 + trex_tx_bps = sum(trex_res.get_value_list("trex-global.data.m_tx_bps")[-4:-1]) / 3.0 + test_norm_cpu = 200.0 * trex_tx_bps / (cores * cpu_util * 1e6) print("TRex CPU utilization: %g%%, norm_cpu is : %d Mb/core" % (round(cpu_util), int(test_norm_cpu))) - #expected_norm_cpu = self.get_benchmark_param('cpu_to_core_ratio') - - #calc_error_precent = abs(100.0*(test_norm_cpu/expected_norm_cpu)-100.0) - -# if calc_error_precent > err: -# msg ='Normalized bandwidth to CPU utilization ratio is %2.0f Mb/core expected %2.0f Mb/core more than %2.0f %% - ERROR' % (test_norm_cpu, expected_norm_cpu, err) -# raise AbnormalResultError(msg) -# else: -# msg ='Normalized bandwidth to CPU utilization ratio is %2.0f Mb/core expected %2.0f Mb/core less than %2.0f %% - OK' % (test_norm_cpu, expected_norm_cpu, err) -# print msg + expected_norm_cpu = self.get_benchmark_param('bw_per_core') + if not expected_norm_cpu: + expected_norm_cpu = '1' + calc_error_precent = abs(100.0 * test_norm_cpu / expected_norm_cpu - 100) + print('Err percent: %s' % calc_error_precent) + # TODO: gather statistics from regression, uncomment ASAP + #if calc_error_precent > err: + # raise AbnormalResultError('Excepted bw_per_core ratio %s, got %s' % (bw_per_core, test_norm_cpu)) def check_results_gt (self, res, name, val): diff --git a/scripts/automation/regression/stateful_tests/trex_nat_test.py b/scripts/automation/regression/stateful_tests/trex_nat_test.py index 512ad4e4..b2df684d 100755 --- a/scripts/automation/regression/stateful_tests/trex_nat_test.py +++ b/scripts/automation/regression/stateful_tests/trex_nat_test.py @@ -54,9 +54,9 @@ class CTRexNoNat_Test(CTRexGeneral_Test):#(unittest.TestCase): learning_stats = trex_res.get_last_value("trex-global.data", ".*nat.*") # extract all nat data if self.get_benchmark_param('allow_timeout_dev'): - nat_timeout_ratio = learning_stats['m_total_nat_time_out']/learning_stats['m_total_nat_open'] + nat_timeout_ratio = float(learning_stats['m_total_nat_time_out']) / learning_stats['m_total_nat_open'] if nat_timeout_ratio > 0.005: - self.fail('TRex nat_timeout ratio %f > 0.005 (0.5%) and not as expected to be less than 0.5%' %(nat_timeout_ratio)) + self.fail('TRex nat_timeout ratio %f > 0.5%%' % nat_timeout_ratio) else: self.check_results_eq (learning_stats, 'm_total_nat_time_out', 0.0) self.check_results_eq (learning_stats, 'm_total_nat_no_fid', 0.0) @@ -128,7 +128,7 @@ class CTRexNat_Test(CTRexGeneral_Test):#(unittest.TestCase): trex_nat_stats = trex_res.get_last_value("trex-global.data", ".*nat.*") # extract all nat data if self.get_benchmark_param('allow_timeout_dev'): - nat_timeout_ratio = trex_nat_stats['m_total_nat_time_out']/trex_nat_stats['m_total_nat_open'] + nat_timeout_ratio = float(trex_nat_stats['m_total_nat_time_out']) / trex_nat_stats['m_total_nat_open'] if nat_timeout_ratio > 0.005: self.fail('TRex nat_timeout ratio %f > 0.5%%' % nat_timeout_ratio) else: diff --git a/scripts/automation/regression/stateful_tests/trex_rx_test.py b/scripts/automation/regression/stateful_tests/trex_rx_test.py index a6cc4bc6..ac7ba592 100755 --- a/scripts/automation/regression/stateful_tests/trex_rx_test.py +++ b/scripts/automation/regression/stateful_tests/trex_rx_test.py @@ -70,7 +70,7 @@ class CTRexRx_Test(CTRexGeneral_Test): error_tolerance = self.get_benchmark_param('error_tolerance') if not error_tolerance or not allow_error_tolerance: error_tolerance = 0 - error_percentage = float(total_errors) * 100 / total_rx + error_percentage = total_errors * 100.0 / total_rx if total_errors > 0: if self.is_loopback or error_percentage > error_tolerance: @@ -98,19 +98,24 @@ class CTRexRx_Test(CTRexGeneral_Test): p = True, nc = True, rx_check = sample_rate, - d = 100, + d = 50, f = 'avl/sfr_delay_10_1g_no_bundeling.yaml', l = 1000, k = 10, learn_verify = True, + iom = 1, l_pkt_mode = 2) trex_res = self.trex.sample_to_run_finish() print("\nLATEST RESULT OBJECT:") print(trex_res) - #print ("\nLATEST DUMP:") - #print trex_res.get_latest_dump() + print ("\nLATEST DUMP:") + print trex_res.get_latest_dump() + cpu_util = trex_res.get_last_value("trex-global.data.m_cpu_util") + cpu_util_hist = trex_res.get_value_list("trex-global.data.m_cpu_util") + print("cpu util is:", cpu_util) + print(cpu_util_hist) self.check_general_scenario_results(trex_res) self.check_CPU_benchmark(trex_res) @@ -238,6 +243,7 @@ class CTRexRx_Test(CTRexGeneral_Test): l = 1000, k = 10, learn_verify = True, + iom = 1, l_pkt_mode = 2) print('Run for 40 seconds, expect no errors') |