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")

Signed-off-by: Andrew Bailey <[email protected]>
---
 dts/tests/TestSuite_single_core_forward_perf.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dts/tests/TestSuite_single_core_forward_perf.py 
b/dts/tests/TestSuite_single_core_forward_perf.py
index 8a92ba39b5..1e7ab7b036 100644
--- a/dts/tests/TestSuite_single_core_forward_perf.py
+++ b/dts/tests/TestSuite_single_core_forward_perf.py
@@ -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)
-- 
2.50.1

Reply via email to