* [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss.
@ 2020-03-13 8:27 yufengmx
2020-03-13 8:27 ` [dts] [PATCH V1 1/1] " yufengmx
2020-03-16 2:25 ` [dts] [PATCH V1 0/1] " Mo, YufengX
0 siblings, 2 replies; 4+ messages in thread
From: yufengmx @ 2020-03-13 8:27 UTC (permalink / raw)
To: dts, lijuan.tu, yingyax.han; +Cc: yufengmx
measure_rfc2544_dichotomy/loss rate add actual line rate return value.
yufengmx (1):
framework/pktgen: add actual line rate return for loss.
framework/pktgen_base.py | 47 ++++++++++++++++++++++++++++++----------
1 file changed, 35 insertions(+), 12 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts] [PATCH V1 1/1] framework/pktgen: add actual line rate return for loss.
2020-03-13 8:27 [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss yufengmx
@ 2020-03-13 8:27 ` yufengmx
2020-03-16 2:25 ` [dts] [PATCH V1 0/1] " Mo, YufengX
1 sibling, 0 replies; 4+ messages in thread
From: yufengmx @ 2020-03-13 8:27 UTC (permalink / raw)
To: dts, lijuan.tu, yingyax.han; +Cc: yufengmx
measure_rfc2544_dichotomy/loss rate add actual line rate return value.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
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..bee703e 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -263,6 +263,7 @@ class PacketGenerator(object):
"""
delay = options.get('delay')
duration = options.get('duration') or 10
+ throughput_stat_flag = options.get('throughput_stat_flag') or False
self._prepare_transmission(stream_ids=stream_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 = self.__get_single_throughput_statistic(stream_ids)
self._stop_transmission(None)
result = {}
used_rx_port = []
@@ -287,7 +290,10 @@ class PacketGenerator(object):
if loss_rate < 0:
loss_rate = 0
result[port_id] = (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=[], options={}):
'''
@@ -491,6 +497,7 @@ class PacketGenerator(object):
accuracy = options.get('accuracy') or 0.001
permit_loss_rate = options.get('pdr') or 0.0
duration = options.get('duration') or 10.0
+ throughput_stat_flag = options.get('throughput_stat_flag') or False
# start warm up traffic
delay = options.get('delay')
_options = {'duration': duration}
@@ -505,10 +512,14 @@ class PacketGenerator(object):
traffic_rate_min = min_rate
while True:
# run loss rate testing
- _options = {'duration': duration}
+ _options = {
+ 'throughput_stat_flag': throughput_stat_flag,
+ 'duration': duration, }
result = self._measure_loss(stream_ids, _options)
loss_rate_table.append([rate, result])
- status = self._check_loss_rate(result, permit_loss_rate)
+ status = 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 == max_rate and status:
hit_result = 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 = ('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]
+ if throughput_stat_flag:
+ if not hit_result[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][0][1], result[0][0][2], 0
+ else:
+ self.logger.debug(pformat(loss_rate_table))
+ ret_value = 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 = rate, hit_result[0][1], hit_result[0][2]
+ if not hit_result:
+ 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 ret_value
--
2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss.
2020-03-13 8:27 [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss yufengmx
2020-03-13 8:27 ` [dts] [PATCH V1 1/1] " yufengmx
@ 2020-03-16 2:25 ` Mo, YufengX
1 sibling, 0 replies; 4+ messages in thread
From: Mo, YufengX @ 2020-03-16 2:25 UTC (permalink / raw)
To: dts, Tu, Lijuan, Han, YingyaX
Ignore this version. Version 2 upstreamed.
> -----Original Message-----
> From: Mo, YufengX
> Sent: Friday, March 13, 2020 4:27 PM
> To: dts@dpdk.org; Tu, Lijuan <lijuan.tu@intel.com>; Han, YingyaX <yingyax.han@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V1 0/1] framework/pktgen: add actual line rate return for loss.
>
> measure_rfc2544_dichotomy/loss rate add actual line rate return value.
>
> yufengmx (1):
> framework/pktgen: add actual line rate return for loss.
>
> framework/pktgen_base.py | 47 ++++++++++++++++++++++++++++++----------
> 1 file changed, 35 insertions(+), 12 deletions(-)
>
> --
> 2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss.
@ 2020-03-16 2:28 yufengmx
0 siblings, 0 replies; 4+ messages in thread
From: yufengmx @ 2020-03-16 2:28 UTC (permalink / raw)
To: dts, lijuan.tu, yingyax.han; +Cc: yufengmx
measure_rfc2544_dichotomy/loss rate add actual line rate return value.
v2:
- add result Null type check.
yufengmx (1):
framework/pktgen: add actual line rate return for loss.
framework/pktgen_base.py | 47 ++++++++++++++++++++++++++++++----------
1 file changed, 35 insertions(+), 12 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-16 2:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 8:27 [dts] [PATCH V1 0/1] framework/pktgen: add actual line rate return for loss yufengmx
2020-03-13 8:27 ` [dts] [PATCH V1 1/1] " yufengmx
2020-03-16 2:25 ` [dts] [PATCH V1 0/1] " Mo, YufengX
2020-03-16 2:28 yufengmx
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).