From patchwork Wed Mar 31 10:16:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tu, Lijuan" X-Patchwork-Id: 90153 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42C08A0547; Wed, 31 Mar 2021 04:18:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A494140DD9; Wed, 31 Mar 2021 04:18:03 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 24D8740141 for ; Wed, 31 Mar 2021 04:18:00 +0200 (CEST) IronPort-SDR: 0PrBvqMr3rA1ymbJiiGLKHCv+gdJ9tjyg2mCoXYyClmZKlx5lMWsHYmt0caOduor428FDxB7s2 qoRFA2RClWSA== X-IronPort-AV: E=McAfee;i="6000,8403,9939"; a="179027929" X-IronPort-AV: E=Sophos;i="5.81,291,1610438400"; d="scan'208";a="179027929" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2021 19:17:58 -0700 IronPort-SDR: 7jtWn8y60IxskuJhPOPgvxiG8m49TaH+cxwLTFhnw25VixVhBpsDgV8YYpG9st4K6NHklSV4ld +hs77ViNVwcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,291,1610438400"; d="scan'208";a="445432387" Received: from dpdk-icelake-perf.sh.intel.com ([10.67.118.199]) by fmsmga002.fm.intel.com with ESMTP; 30 Mar 2021 19:17:57 -0700 From: Lijuan Tu To: dliu@iol.unh.edu, ohilyard@iol.unh.edu, alialnu@nvidia.com Cc: dts@dpdk.org, Lijuan Tu Date: Wed, 31 Mar 2021 10:16:55 +0000 Message-Id: <20210331101659.506185-3-lijuan.tu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331101659.506185-1-lijuan.tu@intel.com> References: <20210331101659.506185-1-lijuan.tu@intel.com> MIME-Version: 1.0 Subject: [dts] [v3 2/6] tests/nic_single_core_perf: get better throughput stats X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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" Snice throughput is easily fluctuated, we want to improve reliable for results by following: * get multiple throughput statistics during the run time. * remove the maximum and minimum and get average. * sample interval could be configured by users Signed-off-by: Lijuan Tu --- conf/nic_single_core_perf.cfg | 4 +++ tests/TestSuite_nic_single_core_perf.py | 42 +++++++++++++++++++------ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/conf/nic_single_core_perf.cfg b/conf/nic_single_core_perf.cfg index 4d3279ba..e6b0a5af 100644 --- a/conf/nic_single_core_perf.cfg +++ b/conf/nic_single_core_perf.cfg @@ -5,6 +5,9 @@ # numbers, and the pattern is # {'frame size': ['descriptor number #1', 'descriptor number #2']} # +# - throughput_stat_sample_interval defines interval of get throughput +# statistics (second). If not set, it is 5 seconds by default. +# # - test_duration is how many seconds each combination performance will # be recorded. # @@ -34,6 +37,7 @@ test_parameters = {'1C/1T': {64: [512, 2048]}, '1C/2T': {64: [512, 2048]}} rx_desc_16byte = 'y' test_duration = 60 +throughput_stat_sample_interval = 2 accepted_tolerance = 1 expected_throughput = { 'fortville_spirit': { diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py index edb4465d..a0a257dd 100644 --- a/tests/TestSuite_nic_single_core_perf.py +++ b/tests/TestSuite_nic_single_core_perf.py @@ -41,6 +41,7 @@ from exception import VerifyFailure from settings import HEADER_SIZE, UPDATE_EXPECTED, load_global_setting from pmd_output import PmdOutput from copy import deepcopy +from numpy import mean import rst from pktgen import PacketGeneratorHelper @@ -96,6 +97,7 @@ class TestNicSingleCorePerf(TestCase): # traffic duraion in second self.test_duration = self.get_suite_cfg()['test_duration'] + self.throughput_stat_sample_interval = self.get_suite_cfg().get('throughput_stat_sample_interval', 5) # load the expected throughput for required nic if self.nic in ["ConnectX4_LX_MT4117"]: @@ -265,21 +267,43 @@ class TestNicSingleCorePerf(TestCase): # run packet generator streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, vm_config, self.tester.pktgen) # set traffic option - traffic_opt = {'duration': self.test_duration} - # _, pps = self.tester.traffic_generator_throughput(tgenInput, rate_percent=100, delay=30) - _, packets_received = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt) - self.verify(packets_received > 0, "No traffic detected") - throughput = packets_received / 1000000.0 - self.throughput[fwd_config][frame_size][nb_desc] = throughput + traffic_opt = { + 'method': 'throughput', + 'rate': 100, + 'duration': self.test_duration, + 'interval': self.throughput_stat_sample_interval, + } + stats = self.tester.pktgen.measure(stream_ids=streams, traffic_opt=traffic_opt) + + ##################################################### + # Remove max and min if count >=5, then get average + ##################################################### + if isinstance(stats, list): + total_pps_rxs = [] + c = len(stats) + for i in range(c): + stats_pps = stats[i][1] + if isinstance(stats_pps, tuple): + total_pps_rxs.append(stats_pps[1]) + else: + total_pps_rxs.append(stats_pps) + if c >= 5: + total_pps_rxs.remove(max(total_pps_rxs)) + total_pps_rxs.remove(min(total_pps_rxs)) + total_pps_rx = mean(total_pps_rxs) + else: + total_pps_rx = stats + + self.verify(total_pps_rx > 0, "No traffic detected, please check your configuration") + total_mpps_rx = total_pps_rx / 1000000.0 + self.throughput[fwd_config][frame_size][nb_desc] = total_mpps_rx self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) - self.verify(throughput, - "No traffic detected, please check your configuration") self.logger.info("Trouthput of " + "framesize: {}, rxd/txd: {} is :{} Mpps".format( - frame_size, nb_desc, throughput)) + frame_size, nb_desc, total_mpps_rx)) return self.throughput