Skip to contentSkip to conversation

dts: reduce precision for single-core performance test suite

PATCH New Andrew Bailey 1 participant 1 message Feb 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dts: reduce precision for single-core performance test suite

Previously, the single-core performance test suite did not limit the significant figures written to the result json file. This patch limits the results for the output and the json result file to the thousandths place.

Bugzilla ID: 1895

Fixes d77d7f04f24c ("dts: add single-core performance test suite")
---
 dts/tests/TestSuite_single_core_forward_perf.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
dts/tests/TestSuite_single_core_forward_perf.py +7 -5
index 8a92ba39b5..1e7ab7b036 100644
@@ -91,7 +91,7 @@ def _produce_stats_table(self, test_parameters: list[dict[str, int | float]]) ->
         print("-" * len(header))
         for params in test_parameters:
             print(f"{params['frame_size']:>12} | {params['num_descriptors']:>12} | ", end="")
-            print(f"{params['measured_mpps']:>12.2f} | {params['expected_mpps']:>14.2f}")
+            print(f"{params['measured_mpps']:>12} | {params['expected_mpps']:>14}")
             print("-" * len(header))
 
         write_performance_json({"results": test_parameters})
@@ -131,10 +131,12 @@ def single_core_forward_perf(self) -> None:
             with TestPmd(
                 **driver_specific_testpmd_args,
             ) as testpmd:
-                params["measured_mpps"] = self._transmit(testpmd, frame_size)
-                params["performance_delta"] = (
-                    float(params["measured_mpps"]) - float(params["expected_mpps"])
-                ) / float(params["expected_mpps"])
+                params["measured_mpps"] = round(self._transmit(testpmd, frame_size), 3)
+                params["performance_delta"] = round(
+                    (float(params["measured_mpps"]) - float(params["expected_mpps"]))
+                    / float(params["expected_mpps"]),
+                    3,
+                )
                 params["pass"] = float(params["performance_delta"]) >= -self.delta_tolerance
 
         self._produce_stats_table(self.test_parameters)
Signature · 1 line
2.50.1