[PATCH v3] app/dma-perf: add average latency per worker

Vipin Varghese vipin.varghese at amd.com
Fri Mar 8 20:06:46 CET 2024


Modify the user information with total average latency per worker
in both CSV and console logs.

Signed-off-by: Vipin Varghese <vipin.varghese at amd.com>

V3 Changes:
 - update CSV_TOTAL_LINE_FMT to change Avg Cycles / op per worker

V2 Changes:
 - keep one-digit precision is enough, suggested by Chengwen
---
 app/test-dma-perf/benchmark.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
index 9b1f58c78c..fca3ba24f7 100644
--- a/app/test-dma-perf/benchmark.c
+++ b/app/test-dma-perf/benchmark.c
@@ -23,7 +23,7 @@
 #define CSV_LINE_DMA_FMT "Scenario %u,%u,%s,%u,%u,%u,%u,%.2lf,%" PRIu64 ",%.3lf,%.3lf\n"
 #define CSV_LINE_CPU_FMT "Scenario %u,%u,NA,NA,NA,%u,%u,%.2lf,%" PRIu64 ",%.3lf,%.3lf\n"
 
-#define CSV_TOTAL_LINE_FMT "Scenario %u Summary, , , , , ,%u,%.2lf,%u,%.3lf,%.3lf\n"
+#define CSV_TOTAL_LINE_FMT "Scenario %u Summary, , , , , ,%u,%.2lf,%.1lf,%.3lf,%.3lf\n"
 
 struct worker_info {
 	bool ready_flag;
@@ -470,10 +470,11 @@ mem_copy_benchmark(struct test_configure *cfg, bool is_dma)
 		bandwidth_total += bandwidth;
 		avg_cycles_total += avg_cycles;
 	}
-	printf("\nTotal Bandwidth: %.3lf Gbps, Total MOps: %.3lf\n", bandwidth_total, mops_total);
+	printf("\nAverage Cycles/op per worker: %.1lf, Total Bandwidth: %.3lf Gbps, Total MOps: %.3lf\n",
+		(avg_cycles_total * (float) 1.0) / nb_workers, bandwidth_total, mops_total);
 	snprintf(output_str[MAX_WORKER_NB], MAX_OUTPUT_STR_LEN, CSV_TOTAL_LINE_FMT,
 			cfg->scenario_id, nr_buf, memory * nb_workers,
-			avg_cycles_total / nb_workers, bandwidth_total, mops_total);
+			(avg_cycles_total * (float) 1.0) / nb_workers, bandwidth_total, mops_total);
 
 out:
 	/* free mbufs used in the test */
-- 
2.39.3



More information about the dev mailing list