aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-02-28 10:13:12 +0100
committerPeter Mikus <pmikus@cisco.com>2018-03-05 05:52:24 +0000
commit4c75804c85ffa7ef236fff24ea8d159ca2dc73b7 (patch)
tree9784bcfc6ae78f6ddf150ddef1336f7660cc5af9 /resources/libraries/python/TrafficGenerator.py
parenta4cdbf05722f6e880f465121a416828278195bd7 (diff)
Performance KW optimizations II
Currently Binary Search is using TRex warmup time for every lookup trial. This patch is suppose to optimize Binary Search to not use warmup time for each trial apart from first one. Change-Id: I9b914cfac3ce558557133c266335c1f550c0b52a Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-rw-r--r--resources/libraries/python/TrafficGenerator.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index f363fe3f55..b7c8d6ef4e 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -33,7 +33,7 @@ class TGDropRateSearchImpl(DropRateSearch):
super(TGDropRateSearchImpl, self).__init__()
def measure_loss(self, rate, frame_size, loss_acceptance,
- loss_acceptance_type, traffic_type):
+ loss_acceptance_type, traffic_type, skip_warmup=False):
"""Runs the traffic and evaluate the measured results.
:param rate: Offered traffic load.
@@ -41,11 +41,13 @@ class TGDropRateSearchImpl(DropRateSearch):
:param loss_acceptance: Permitted drop ratio or frames count.
:param loss_acceptance_type: Type of permitted loss.
:param traffic_type: Traffic profile ([2,3]-node-L[2,3], ...).
+ :param skip_warmup: Start TRex without warmup traffic if true.
:type rate: int
:type frame_size: str
:type loss_acceptance: float
:type loss_acceptance_type: LossAcceptanceType
:type traffic_type: str
+ :type skip_warmup: bool
:returns: Drop threshold exceeded? (True/False)
:rtype: bool
:raises: NotImplementedError if TG is not supported.
@@ -60,9 +62,15 @@ class TGDropRateSearchImpl(DropRateSearch):
raise RuntimeError('TG subtype not defined')
elif tg_instance.node['subtype'] == NodeSubTypeTG.TREX:
unit_rate = str(rate) + self.get_rate_type_str()
- tg_instance.trex_stl_start_remote_exec(self.get_duration(),
- unit_rate, frame_size,
- traffic_type)
+ if skip_warmup:
+ tg_instance.trex_stl_start_remote_exec(self.get_duration(),
+ unit_rate, frame_size,
+ traffic_type,
+ warmup_time=0)
+ else:
+ tg_instance.trex_stl_start_remote_exec(self.get_duration(),
+ unit_rate, frame_size,
+ traffic_type)
loss = tg_instance.get_loss()
sent = tg_instance.get_sent()
if self.loss_acceptance_type_is_percentage():