From bfecf48abaeaf61751fb4d74e91acb456cef13e9 Mon Sep 17 00:00:00 2001 From: Ananda Ravuri <33236856+anandaravuri@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:34:08 -0800 Subject: [PATCH] Fix:CXL Host exerciser calculations and output string (#3042) * Fix:CXL Host exerciser calculations and output string The CXL host exerciser read latency output string has been modified with the "Total transaction time nanoseconds". Signed-off-by: anandaravuri --- samples/cxl_host_exerciser/cxl_he_cmd.h | 29 ++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/samples/cxl_host_exerciser/cxl_he_cmd.h b/samples/cxl_host_exerciser/cxl_he_cmd.h index f5264d230769..34d073c03304 100644 --- a/samples/cxl_host_exerciser/cxl_he_cmd.h +++ b/samples/cxl_host_exerciser/cxl_he_cmd.h @@ -77,24 +77,23 @@ class he_cmd : public test_command { cout << "actual data:" << dsm_status->actual_data << endl; cout << "expected data:" << dsm_status->expected_data << endl; + double latency = 0; + double perf_data = 0; // print bandwidth if (dsm_status->num_ticks > 0) { - double perf_data = - he_num_xfers_to_bw(dsm_status->num_reads + dsm_status->num_writes, - dsm_status->num_ticks); - host_exe_->logger_->info("Bandwidth: {0:0.3f} GB/s", perf_data); - } - - if (cxl_latency == HE_CXL_RD_LATENCY) { - if (dsm_status->num_ticks > 0 && dsm_status->num_reads > 0) { - double latency = (double)((dsm_status->num_ticks / (double)dsm_status->num_reads) - *( 2.5)); - - host_exe_->logger_->info("Read Latency : {0:0.2f} nanoseconds", latency); - } - else { - host_exe_->logger_->info("Read Latency: N/A"); + perf_data = he_num_xfers_to_bw(dsm_status->num_reads + + dsm_status->num_writes, dsm_status->num_ticks); + + if (cxl_latency == HE_CXL_RD_LATENCY) { + //To convert clock ticks to nanoseconds,multiply the clock ticks by 2.5 + latency = (double)(dsm_status->num_ticks * 2.5); + host_exe_->logger_->info("Bandwidth: {0:0.3f} GB/s Total transaction time: {1:0.2f} nanoseconds", + perf_data, latency); + } else { + host_exe_->logger_->info("Bandwidth: {0:0.3f} GB/s", perf_data); } + } else { + host_exe_->logger_->info("Read Latency: N/A"); } cout << "********* DSM Status CSR end *********" << endl;