From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A140BA0567; Fri, 13 Mar 2020 09:23:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9956F1C029; Fri, 13 Mar 2020 09:23:48 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 66DCA1C011 for ; Fri, 13 Mar 2020 09:23:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 01:23:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,547,1574150400"; d="scan'208";a="236893188" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.222]) by fmsmga008.fm.intel.com with ESMTP; 13 Mar 2020 01:23:44 -0700 From: yufengmx To: dts@dpdk.org, lijuan.tu@intel.com, yingyax.han@intel.com Cc: yufengmx Date: Fri, 13 Mar 2020 16:27:23 +0800 Message-Id: <20200313082723.24945-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200313082723.24945-1-yufengx.mo@intel.com> References: <20200313082723.24945-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 1/1] l3fwd: update display format and json content X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" #. update rfc2544 display format. #. add rfc2544 actual line rate return value. #. update json content. Signed-off-by: yufengmx --- tests/l3fwd_base.py | 54 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/tests/l3fwd_base.py b/tests/l3fwd_base.py index 431c28e..ca5a9f8 100644 --- a/tests/l3fwd_base.py +++ b/tests/l3fwd_base.py @@ -390,6 +390,7 @@ class L3fwdBase(object): 'rate': max_rate, 'traffic_opt': { 'method': 'rfc2544_dichotomy', + 'throughput_stat_flag': True, 'max_rate': max_rate, 'min_rate': min_rate, 'accuracy': accuracy, @@ -399,7 +400,7 @@ class L3fwdBase(object): result = self.__send_packets_by_pktgen(option) # statistics result if result: - _, tx_pkts, rx_pkts = result + _, tx_pkts, rx_pkts, _ = result self.verify(tx_pkts > 0, "No traffic detected") self.verify(rx_pkts > 0, "No packet transfer detected") else: @@ -519,11 +520,11 @@ class L3fwdBase(object): return {"unit": "Mpps", "name": "Throughput", "value": value[0], "delta": value[1]} - def __json_line_rate(self, value): + def __json_rate_percent(self, value): return {"unit": "", "name": "% of Line Rate", "value": value} def __json_port_config(self, value): - return {"unit": "", "name": "Number of Cores/Queues/Threads", + return {"unit": "", "name": "Number of Cores/Threads/Queues", "value": value} def __json_frame_size(self, value): @@ -531,38 +532,36 @@ class L3fwdBase(object): "value": value} def __save_throughput_result(self, case_name, result): - suite_results = {} - case_result = suite_results[case_name] = [] + case_result = [] for sub_result in result: - status, throughput, line_rate, port_config, frame_size = sub_result + status, throughput, rate_percent, port_config, frame_size = sub_result one_result = { "status": status, "performance": [ self.__json_throughput(throughput), - self.__json_line_rate(line_rate), ], + self.__json_rate_percent(rate_percent), ], "parameters": [ self.__json_port_config(port_config), self.__json_frame_size(frame_size), ]} case_result.append(one_result) - self.logger.debug(pformat(suite_results)) - self.__json_results[case_name] = suite_results + self.logger.debug(pformat(case_result)) + self.__json_results[case_name] = case_result def __save_rfc2544_result(self, case_name, result): - suite_results = {} - case_result = suite_results[case_name] = [] + case_result = [] for sub_result in result: - status, rfc2544, line_rate, port_config, frame_size = sub_result + status, rfc2544, rate_percent, port_config, frame_size = sub_result one_result = { "status": status, "performance": [ self.__json_rfc2544(rfc2544), - self.__json_line_rate(line_rate), ], + self.__json_rate_percent(rate_percent), ], "parameters": [ self.__json_port_config(port_config), self.__json_frame_size(frame_size), ]} case_result.append(one_result) - self.logger.debug(pformat(suite_results)) - self.__json_results[case_name] = suite_results + self.logger.debug(pformat(case_result)) + self.__json_results[case_name] = case_result def l3fwd_save_results(self, json_file=None): if not self.__json_results: @@ -627,7 +626,7 @@ class L3fwdBase(object): 'ignore check').format(config, frame_size) self.logger.warning(msg) status = 'pass' - js_results.append([status, result, linerate, config, frame_size]) + js_results.append([status, [pps, linerate - pps], percentage, config, frame_size]) # save data with json format self.__save_throughput_result(self.__cur_case, js_results) # display result table @@ -656,18 +655,23 @@ class L3fwdBase(object): self.__test_content.get('expected_rfc2544', {}).get( self.__cur_case, {}).get(self.__nic_name, {}).get( config, {}).get(str(frame_size), {}) - zero_loss_rate, tx_pkts, rx_pkts = result if result else [None] * 3 + zero_loss_rate, tx_pkts, rx_pkts, pps = result if result else [None] * 3 + mpps = pps / 1000000.0 # expected line rate _frame_size = self.__get_frame_size(stm_name, frame_size) linerate = self.wirespeed( self.nic, _frame_size, len(self.__valports)) - throughput = linerate * zero_loss_rate / 100 + actual_rate_percent = mpps * 100 / linerate # append data for display pdr = expected_cfg.get('traffic_opt', {}).get('pdr') values.append([ config, frame_size, mode.upper(), - str(throughput), + str(linerate), + str(mpps), str(zero_loss_rate), + str(actual_rate_percent), + str(tx_pkts), + str(rx_pkts), ]) # check data with expected values expected_rate = float(expected_cfg.get('rate') or 100.0) @@ -675,7 +679,9 @@ class L3fwdBase(object): if zero_loss_rate and zero_loss_rate > expected_rate \ else 'failed' js_results.append( - [status, [zero_loss_rate, 0], linerate, config, frame_size]) + [status, + [mpps, linerate - mpps], actual_rate_percent, + config, frame_size]) # save data in json file self.__save_rfc2544_result(self.__cur_case, js_results) # display result table @@ -683,8 +689,12 @@ class L3fwdBase(object): 'Total Cores/Threads/Queues per port', "Frame Size", "Mode", - 'Theory line rate (Mpps) '.format(mode.upper()), - '{} Mode Zero Loss Rate % '.format(mode.upper()), + 'Expected Throughput (Mpps)', + 'Actual line rate (Mpps) ', + '{} Mode config line rate % '.format(mode.upper()), + '{} Mode actual line rate % '.format(mode.upper()), + 'tx_pkts', + 'rx_pkts', ] _data = { -- 2.21.0