From 919fdbd0f6ee7f312b80813c53866c2a4213a818 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 8 Jan 2020 15:08:14 +0100 Subject: [PATCH] Track real(er) duration of traffic + Print duration. - Missing: Parse duration. - We do not have good formula to compensate, yet. Change-Id: I1c76ac35ce531b1994480d6aa0638f16992231f5 Signed-off-by: Vratko Polak --- resources/tools/trex/trex_stateless_profile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/tools/trex/trex_stateless_profile.py b/resources/tools/trex/trex_stateless_profile.py index 90a4cf0bec..9323d8a859 100755 --- a/resources/tools/trex/trex_stateless_profile.py +++ b/resources/tools/trex/trex_stateless_profile.py @@ -21,6 +21,7 @@ latency. import argparse import json import sys +import time sys.path.insert( 0, u"/opt/trex-core-2.73/scripts/automation/trex_control_plane/interactive/" @@ -158,10 +159,13 @@ def simple_burst( client.clear_stats() # Choose rate and start traffic: + time_start = time.time() client.start(ports=ports, mult=rate, duration=warmup_time) # Block until done: client.wait_on_traffic(ports=ports, timeout=warmup_time+30) + time_stop = time.time() + print(f"Warmup traffic took {time_stop - time_start} seconds.") if client.get_warnings(): for warning in client.get_warnings(): @@ -187,6 +191,7 @@ def simple_burst( lost_b = 0 # Choose rate and start traffic: + time_start = time.time() client.start(ports=ports, mult=rate, duration=duration) if async_start: @@ -199,6 +204,8 @@ def simple_burst( else: # Block until done: client.wait_on_traffic(ports=ports, timeout=duration+30) + time_stop = time.time() + print(f"Main traffic took {time_stop - time_start} seconds.") if client.get_warnings(): for warning in client.get_warnings(): -- 2.16.6