[v2] app/dma-perf: add average latency per worker
Checks
Commit Message
Modify the user display data with total average latency per worker.
Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
V2 Changes:
- keep one-digit precision is enough, suggested by Chengwen
---
app/test-dma-perf/benchmark.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi Vipin,
On 2024/3/6 23:06, Vipin Varghese wrote:
> Modify the user display data with total average latency per worker.
>
> Signed-off-by: Vipin Varghese <vipin.varghese@amd.com>
>
> V2 Changes:
> - keep one-digit precision is enough, suggested by Chengwen
> ---
> app/test-dma-perf/benchmark.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c
> index 9b1f58c78c..2e110d0d98 100644
> --- a/app/test-dma-perf/benchmark.c
> +++ b/app/test-dma-perf/benchmark.c
> @@ -470,7 +470,8 @@ 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: %.1f, 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);
As previous mentioned, please make sure the csv format and the above snprintf also modified (make sure stdout and csv has the same value).
>
<snipped>
>> - printf("\nTotal Bandwidth: %.3lf Gbps, Total MOps: %.3lf\n", bandwidth_total, mops_total);
>> + printf("\nAverage Cycles/op per worker: %.1f, 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);
> As previous mentioned, please make sure the csv format and the above snprintf also modified (make sure stdout and csv has the same value).
Hi Chengwen, the CSV_TOTAL_LINE_FMT already has `Cycles/op` with `%u`. I
think you are asking to convert this to `%0.1f`to keep it same as `printf`.
Sure I will share v3 for the same.
@@ -470,7 +470,8 @@ 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: %.1f, 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);