From: Ondrej Lichtner <olichtne(a)redhat.com>
We shouldn't use "None" for initialization of timestamps as it breaks
any time alignment/time slice related code that works with these
results.
Use current timestamp of the controller (code that creates the
PerfResult object) as "good enough" in cases where no timestamp is
returned from the Test tool used.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
.../Perf/Measurements/IperfFlowMeasurement.py | 8 +++++---
.../Perf/Measurements/TRexFlowMeasurement.py | 9 +++++----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
index 10088f4..e52f262 100644
--- a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
+++ b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
@@ -167,7 +167,7 @@ def _prepare_client(self, flow):
def _parse_job_streams(self, job):
result = ParallelPerfResult()
if not job.passed:
- result.append(PerfInterval(0, 0, "bits", None))
+ result.append(PerfInterval(0, 0, "bits", time.time()))
else:
for i in job.result["data"]["end"]["streams"]:
result.append(SequentialPerfResult())
@@ -183,7 +183,9 @@ def _parse_job_streams(self, job):
def _parse_job_cpu(self, job):
if not job.passed:
- return PerfInterval(0, 0, "cpu_percent", None)
+ return PerfInterval(0, 0, "cpu_percent", time.time())
else:
cpu_percent = job.result["data"]["end"]["cpu_utilization_percent"]["host_total"]
- return PerfInterval(cpu_percent, 1, "cpu_percent", None)
+ job_start = job.result["data"]["start"]["timestamp"]["timesecs"]
+ duration = job.result["data"]["end"]["sum_received"]["seconds"]
+ return PerfInterval(cpu_percent*duration, duration, "cpu_percent", job_start)
diff --git a/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py b/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
index b780842..dca58b1 100644
--- a/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
+++ b/lnst/RecipeCommon/Perf/Measurements/TRexFlowMeasurement.py
@@ -147,10 +147,11 @@ def _parse_results_by_port(self, job, port, flow):
results.receiver_cpu_stats = SequentialPerfResult()
if not job.passed:
- results.generator_results.append(PerfInterval(0, 0, "packets", None))
- results.generator_cpu_stats.append(PerfInterval(0, 0, "cpu_percent", None))
- results.receiver_results.append(PerfInterval(0, 0, "packets", None))
- results.receiver_cpu_stats.append(PerfInterval(0, 0, "cpu_percent", None))
+ timestamp = time.time()
+ results.generator_results.append(PerfInterval(0, 0, "packets", timestamp))
+ results.generator_cpu_stats.append(PerfInterval(0, 0, "cpu_percent", timestamp))
+ results.receiver_results.append(PerfInterval(0, 0, "packets", timestamp))
+ results.receiver_cpu_stats.append(PerfInterval(0, 0, "cpu_percent", timestamp))
else:
prev_time = job.result["start_time"]
prev_tx_val = 0
--
2.30.0