aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-01-02 14:18:50 +0100
committerVratko Polak <vrpolak@cisco.com>2019-05-10 14:26:34 +0000
commit752a4c3304581fa375f520fdb15a9f87604e11be (patch)
tree74ecbfcbe5ad68ee428f9e49e34a030bd6ebae74 /resources/libraries/python/TrafficGenerator.py
parent217c3803fc75fd0388b2326593447038647f28bd (diff)
PLRsearch: Use stat trackers to shorten Integrator
+ Extract several tracker classes and use them in Integrator. + Apply next_rate workarounds to focus more on critical region. + Rewrite stretch function, as the previous implementation was wrong. + Rework logging: ++ Use injected trace() function in Integrator. ++ Inject function that skips trace logging on default initialization. ++ Use the same multiprocessing-safe passing, but separate queue. + Set duration to 120m in Robot, but keep at 30m in Python. + Apply minor changes to make computations more reproducible: ++ Attempt to log everything needed by reproducibility in one line. ++ Log samples used, and make it settable as upper limit. ++ Use repr output in TRex scripts, to avoid rounding when copypasting. +- Numpy seems to be sharing PRNG between processes. +-- An edit to disable one thread is needed for full reproducibility. +-- Such an edit is prepared, but will not be merged anytime soon. Change-Id: Icf56429b34ab6de2d18a12e6c676e2d242b3ba4c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-rw-r--r--resources/libraries/python/TrafficGenerator.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 84b9f1ff32..35a701f362 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -425,8 +425,8 @@ class TrafficGenerator(AbstractMeasurer):
command = (
"sh -c '{tool}/resources/tools/trex/trex_stateless_profile.py"
" --profile {prof}/resources/traffic_profiles/trex/{traffic}.py"
- " --duration {duration} --frame_size {frame_size} --rate {rate}"
- " --warmup_time {warmup} --port_0 {p_0} --port_1 {p_1}").format(
+ " --duration {duration!r} --frame_size {frame_size} --rate {rate!r}"
+ " --warmup_time {warmup!r} --port_0 {p_0} --port_1 {p_1}").format(
tool=Constants.REMOTE_FW_DIR, prof=Constants.REMOTE_FW_DIR,
traffic=traffic_profile, duration=duration,
frame_size=frame_size, rate=rate, warmup=warmup_time, p_0=p_0,
@@ -698,8 +698,8 @@ class OptimizedSearch(object):
@staticmethod
def perform_soak_search(
frame_size, traffic_profile, minimum_transmit_rate,
- maximum_transmit_rate, plr_target=1e-7, tdpt=0.2,
- initial_count=50, timeout=1800.0):
+ maximum_transmit_rate, plr_target=1e-7, tdpt=0.1,
+ initial_count=50, timeout=1800.0, trace_enabled=False):
"""Setup initialized TG, perform soak search, return avg and stdev.
:param frame_size: Frame size identifier or value [B].
@@ -734,6 +734,7 @@ class OptimizedSearch(object):
algorithm = PLRsearch(
measurer=tg_instance, trial_duration_per_trial=tdpt,
packet_loss_ratio_target=plr_target,
- trial_number_offset=initial_count, timeout=timeout)
+ trial_number_offset=initial_count, timeout=timeout,
+ trace_enabled=trace_enabled)
result = algorithm.search(minimum_transmit_rate, maximum_transmit_rate)
return result