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 24537A0559; Mon, 16 Mar 2020 03:32:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1631B25D9; Mon, 16 Mar 2020 03:32:29 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 88816FEB for ; Mon, 16 Mar 2020 03:32:27 +0100 (CET) IronPort-SDR: VWKYoPCIXuoI0HcdZ8LQ+KojPQQT+Z2M6WXarE6c9IzHx/ZCcSlW5OpJ3V549/n/ZKaXfbvhfh FXlvH9wU+r2Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2020 19:32:25 -0700 IronPort-SDR: QRIEtGTNqCfyHjOtS2czmyFfMtpRvcq8MPlGZKwDoxExWXIQIbYEgPWRN9vOEUD8Q8mD+/IkiP yuYm0OYJH90w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,558,1574150400"; d="scan'208";a="444973928" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 15 Mar 2020 19:32:26 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 15 Mar 2020 19:32:26 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 16 Mar 2020 10:32:24 +0800 Received: from shsmsx605.ccr.corp.intel.com ([10.109.6.215]) by SHSMSX605.ccr.corp.intel.com ([10.109.6.215]) with mapi id 15.01.1713.004; Mon, 16 Mar 2020 10:32:24 +0800 From: "Mo, YufengX" To: "Tu, Lijuan" , "dts@dpdk.org" , "Han, YingyaX" Thread-Topic: [dts][PATCH V1 1/1] framework/pktgen: add actual line rate return for loss. Thread-Index: AQHV+zoq+a7vBQVKq0mTKa0bkW8WPqhKfx+wgAAAiVA= Date: Mon, 16 Mar 2020 02:32:23 +0000 Message-ID: <3f150f13ae6f457493b312e6f09f2290@intel.com> References: <20200316022830.11028-1-yufengx.mo@intel.com> <20200316022830.11028-2-yufengx.mo@intel.com> <8CE3E05A3F976642AAB0F4675D0AD20E0BBED23A@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <8CE3E05A3F976642AAB0F4675D0AD20E0BBED23A@SHSMSX101.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1 1/1] framework/pktgen: add actual line rate return for loss. 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" Yes, I forgot to change tag.=20 > -----Original Message----- > From: Tu, Lijuan > Sent: Monday, March 16, 2020 10:31 AM > To: Mo, YufengX ; dts@dpdk.org; Han, YingyaX > Subject: RE: [dts][PATCH V1 1/1] framework/pktgen: add actual line rate r= eturn for loss. >=20 > Is this the V2 ? sorry , I am confused by tag and another mail. >=20 > > -----Original Message----- > > From: Mo, YufengX > > Sent: Monday, March 16, 2020 10:29 AM > > To: dts@dpdk.org; Tu, Lijuan ; Han, YingyaX > > > > Cc: Mo, YufengX > > Subject: [dts][PATCH V1 1/1] framework/pktgen: add actual line rate ret= urn > > for loss. > > > > > > measure_rfc2544_dichotomy/loss rate add actual line rate return value. > > > > Signed-off-by: yufengmx > > --- > > framework/pktgen_base.py | 47 ++++++++++++++++++++++++++++++--------- > > - > > 1 file changed, 35 insertions(+), 12 deletions(-) > > > > diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py index > > 7e1ff48..049142f 100644 > > --- a/framework/pktgen_base.py > > +++ b/framework/pktgen_base.py > > @@ -263,6 +263,7 @@ class PacketGenerator(object): > > """ > > delay =3D options.get('delay') > > duration =3D options.get('duration') or 10 > > + throughput_stat_flag =3D options.get('throughput_stat_flag') o= r > > + False > > self._prepare_transmission(stream_ids=3Dstream_ids) > > # start warm up traffic > > self.__warm_up_pktgen(stream_ids, options, delay) @@ -270,6 +2= 71,8 > > @@ class PacketGenerator(object): > > self._start_transmission(stream_ids, options) > > # keep traffic within a duration time > > time.sleep(duration) > > + if throughput_stat_flag: > > + _throughput_stats =3D > > + self.__get_single_throughput_statistic(stream_ids) > > self._stop_transmission(None) > > result =3D {} > > used_rx_port =3D [] > > @@ -287,7 +290,10 @@ class PacketGenerator(object): > > if loss_rate < 0: > > loss_rate =3D 0 > > result[port_id] =3D (loss_rate, tx_pkts, rx_pkts) > > - return result > > + if throughput_stat_flag: > > + return result, _throughput_stats > > + else: > > + return result > > > > def measure_loss(self, stream_ids=3D[], options=3D{}): > > ''' > > @@ -491,6 +497,7 @@ class PacketGenerator(object): > > accuracy =3D options.get('accuracy') or 0.001 > > permit_loss_rate =3D options.get('pdr') or 0.0 > > duration =3D options.get('duration') or 10.0 > > + throughput_stat_flag =3D options.get('throughput_stat_flag') o= r > > + False > > # start warm up traffic > > delay =3D options.get('delay') > > _options =3D {'duration': duration} @@ -505,10 +512,14 @@ clas= s > > PacketGenerator(object): > > traffic_rate_min =3D min_rate > > while True: > > # run loss rate testing > > - _options =3D {'duration': duration} > > + _options =3D { > > + 'throughput_stat_flag': throughput_stat_flag, > > + 'duration': duration, } > > result =3D self._measure_loss(stream_ids, _options) > > loss_rate_table.append([rate, result]) > > - status =3D self._check_loss_rate(result, permit_loss_rate) > > + status =3D self._check_loss_rate( > > + result[0] if throughput_stat_flag else result, > > + permit_loss_rate) > > # if upper bound rate percent hit, quit the left flow > > if rate =3D=3D max_rate and status: > > hit_result =3D result > > @@ -528,16 +539,28 @@ class PacketGenerator(object): > > # set stream rate percent to custom value > > self._set_stream_rate_percent(rate) > > > > - if not hit_result: > > - msg =3D ('expected permit loss rate <{0}> ' > > - 'not between rate {1} and rate {2}').format( > > - permit_loss_rate, max_rate, min_rate) > > - self.logger.error(msg) > > - self.logger.info(pformat(loss_rate_table)) > > - ret_value =3D 0, result[0][1], result[0][2] > > + if throughput_stat_flag: > > + if not hit_result or not hit_result[0]: > > + msg =3D ('expected permit loss rate <{0}> ' > > + 'not between rate {1} and rate {2}').format( > > + permit_loss_rate, max_rate, min_rate) > > + self.logger.error(msg) > > + self.logger.info(pformat(loss_rate_table)) > > + ret_value =3D 0, result[0][0][1], result[0][0][2], 0 > > + else: > > + self.logger.debug(pformat(loss_rate_table)) > > + ret_value =3D rate, hit_result[0][0][1], > > + hit_result[0][0][2], hit_result[1][1] > > else: > > - self.logger.debug(pformat(loss_rate_table)) > > - ret_value =3D rate, hit_result[0][1], hit_result[0][2] > > + if not hit_result: > > + msg =3D ('expected permit loss rate <{0}> ' > > + 'not between rate {1} and rate {2}').format( > > + permit_loss_rate, max_rate, min_rate) > > + self.logger.error(msg) > > + self.logger.info(pformat(loss_rate_table)) > > + ret_value =3D 0, result[0][1], result[0][2] > > + else: > > + self.logger.debug(pformat(loss_rate_table)) > > + ret_value =3D rate, hit_result[0][1], hit_result[0][2] > > self.logger.info("zero loss rate is %f" % rate) > > > > return ret_value > > -- > > 2.21.0