test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, yinan.wang@intel.com, lihongx.ma@intel.com,
	lijuan.tu@intel.com
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/1] framework/pktgen_base: fix rfc2544 dichotomy warm up and
Date: Thu,  2 Jan 2020 16:20:40 +0800	[thread overview]
Message-ID: <20200102082040.16175-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200102082040.16175-1-yufengx.mo@intel.com>

 return value

fix rfc2544 dichotomy warm up and return value.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 framework/pktgen_base.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
index 75c3036..5e51b1a 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -167,7 +167,6 @@ class PacketGenerator(object):
         self._start_transmission(stream_ids, options)
         time.sleep(delay)
         self._stop_transmission(stream_ids)
-        self._clear_streams()
 
     def __get_single_throughput_statistic(self, stream_ids):
         bps_rx = []
@@ -495,7 +494,10 @@ class PacketGenerator(object):
         # start warm up traffic
         delay = options.get('delay')
         _options = {'duration': duration}
-        self.__warm_up_pktgen(stream_ids, _options, delay)
+        if delay:
+            self._prepare_transmission(stream_ids=stream_ids)
+            self.__warm_up_pktgen(stream_ids, _options, delay)
+            self._clear_streams()
         # traffic parameters for dichotomy algorithm
         loss_rate_table = []
         hit_result = None
@@ -527,16 +529,18 @@ class PacketGenerator(object):
             self._set_stream_rate_percent(rate)
 
         if not hit_result:
-            msg = ('expected permit loss rate <{0}>'
+            msg = ('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 = 0, result[0][1], result[0][2]
         else:
             self.logger.debug(pformat(loss_rate_table))
+            ret_value = rate, hit_result[0][1], hit_result[0][2]
         self.logger.info("zero loss rate is %f" % rate)
 
-        return hit_result
+        return ret_value
 
     def measure(self, stream_ids, traffic_opt):
         '''
-- 
2.21.0


  reply	other threads:[~2020-01-02  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02  8:20 [dts] [PATCH V1 0/1] framework/pktgen_base: fix rfc2544 dichotomy warm up and return value fix rfc2544 dichotomy warm up and return value yufengmx
2020-01-02  8:20 ` yufengmx [this message]
2020-01-03  3:04   ` [dts] [PATCH V1 1/1] framework/pktgen_base: fix rfc2544 dichotomy warm up and Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200102082040.16175-2-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    --cc=lihongx.ma@intel.com \
    --cc=lijuan.tu@intel.com \
    --cc=yinan.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).