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 8CCAAA00E6 for ; Tue, 6 Aug 2019 08:57:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 804171B9ED; Tue, 6 Aug 2019 08:57:56 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5FB6F1B9DE for ; Tue, 6 Aug 2019 08:57:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 23:57:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,352,1559545200"; d="scan'208";a="192598357" Received: from dpdk-moyufen01.sh.intel.com ([10.67.111.77]) by fmsmga001.fm.intel.com with ESMTP; 05 Aug 2019 23:57:53 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Tue, 6 Aug 2019 14:58:44 +0800 Message-Id: <1565074724-216584-6-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1565074724-216584-1-git-send-email-yufengx.mo@intel.com> References: <1565074724-216584-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 5/5] framework/pktgen_trex: measure throughput supports multiple 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" return values *. remove duration option in trex module, move duration option in testing scenario methods(latency/loss/throughput) in pktgen_base module. *. remove sample_delay option in trex module. *. remove runtim_stat in trex module. Signed-off-by: yufengmx --- framework/pktgen_trex.py | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py index c05741b..26a802c 100644 --- a/framework/pktgen_trex.py +++ b/framework/pktgen_trex.py @@ -412,7 +412,6 @@ class TrexPacketGenerator(PacketGenerator): self._ports = [] self._traffic_ports = [] self._rx_ports = [] - self.runtime_stats = {} conf_inst = self._get_generator_conf_instance() self.conf = conf_inst.load_pktgen_config() @@ -672,7 +671,7 @@ class TrexPacketGenerator(PacketGenerator): def _throughput_stats(self, stream, stats): # tx packet tx_port_id = stream["tx_port"] - port_stats = self.runtime_stats.get(tx_port_id) + port_stats = stats.get(tx_port_id) if not port_stats: msg = "failed to get tx_port {0} statistics".format(tx_port_id) raise Exception(msg) @@ -686,7 +685,7 @@ class TrexPacketGenerator(PacketGenerator): self.logger.info(os.linesep.join(msg)) # rx bps/pps rx_port_id = stream["rx_port"] - port_stats = self.runtime_stats.get(rx_port_id) + port_stats = stats.get(rx_port_id) if not port_stats: msg = "failed to get rx_port {0} statistics".format(rx_port_id) raise Exception(msg) @@ -788,57 +787,22 @@ class TrexPacketGenerator(PacketGenerator): self._preset_trex_port() def _start_transmission(self, stream_ids, options={}): - ''' - :param sample_delay: - After traffic start ``sample_delay`` seconds, start get runtime statistics - ''' + test_mode = options.get('method') # get rate percentage rate_percent = "{0}%".format(options.get('rate') or self._traffic_opt.get('rate') or '100') - # get duration - duration = options.get("duration") or 20 - duration = int(duration) if isinstance(duration, (str, unicode)) \ - else duration - # get sample interval - _sample_delay = options.get("sample_delay") or duration/2 - sample_delay = int(_sample_delay) \ - if isinstance(_sample_delay, (str, unicode)) \ - else _sample_delay - # get configuration from pktgen config file - warmup = int(self.conf["warmup"]) if self.conf.has_key("warmup") \ - else 25 - # set trex coremask - wait_interval = warmup+30 \ - if self.conf.has_key("core_mask") \ - else warmup+5 - try: - ########################################### # clear the stats before injecting self._conn.clear_stats() # Start traffic on port(s) run_opt = { 'ports': self._traffic_ports, 'mult': rate_percent, - 'duration': duration, 'core_mask': self.core_mask, 'force': True,} self.logger.info("begin traffic ......") self._conn.start(**run_opt) - ########################################### - if sample_delay: - time.sleep(sample_delay) # wait - # get ports runtime statistics - self.runtime_stats = self._conn.get_stats() - self.logger.info(pformat(self.runtime_stats)) - ########################################### - # Block until traffic on specified port(s) has ended - wait_opt = {'ports': self._traffic_ports} - if duration: - time.sleep(wait_interval + 10) - wait_opt['timeout'] = wait_interval + duration - self._conn.wait_on_traffic(**wait_opt) except Exception as e: self.logger.error(e) -- 1.9.3