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 095AEA0559; Mon, 16 Mar 2020 03:30:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C186325D9; Mon, 16 Mar 2020 03:30:51 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id CC560FEB for ; Mon, 16 Mar 2020 03:30:49 +0100 (CET) IronPort-SDR: pBhDlJFzbnzWn1tM88rYuz088kLk7viHITrUJ49dwntXRBCGc4rG1uW8qZwzZccwHcj+RAABeH A1b7UM5K4tPQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2020 19:30:48 -0700 IronPort-SDR: DwMWUJ3Rhjkw/JZMKi2N3bzeHBzLH7IMoIWhh+ap+j6IsJp+PYRd72pYcUlhfSkqHGXvjymMbY qJ5mis5WpdLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,558,1574150400"; d="scan'208";a="444973637" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 15 Mar 2020 19:30:48 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 15 Mar 2020 19:30:48 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 15 Mar 2020 19:30:47 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.96]) with mapi id 14.03.0439.000; Mon, 16 Mar 2020 10:30:44 +0800 From: "Tu, Lijuan" To: "Mo, YufengX" , "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+w Date: Mon, 16 Mar 2020 02:30:44 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBED23A@SHSMSX101.ccr.corp.intel.com> References: <20200316022830.11028-1-yufengx.mo@intel.com> <20200316022830.11028-2-yufengx.mo@intel.com> In-Reply-To: <20200316022830.11028-2-yufengx.mo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] 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" Is this the V2 ? sorry , I am confused by tag and another mail. > -----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 retur= n > for loss. >=20 >=20 > measure_rfc2544_dichotomy/loss rate add actual line rate return value. >=20 > Signed-off-by: yufengmx > --- > framework/pktgen_base.py | 47 ++++++++++++++++++++++++++++++--------- > - > 1 file changed, 35 insertions(+), 12 deletions(-) >=20 > 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') or > + False > self._prepare_transmission(stream_ids=3Dstream_ids) > # start warm up traffic > self.__warm_up_pktgen(stream_ids, options, delay) @@ -270,6 +271= ,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 >=20 > 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') or > + False > # start warm up traffic > delay =3D options.get('delay') > _options =3D {'duration': duration} @@ -505,10 +512,14 @@ class > 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) >=20 > - 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) >=20 > return ret_value > -- > 2.21.0