Skip to content

Commit

Permalink
Fix:CXL Host exerciser calculations and output string (#3042)
Browse files Browse the repository at this point in the history
* 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 <ananda.ravuri@intel.com>
  • Loading branch information
anandaravuri committed Nov 15, 2023
1 parent fac810a commit bfecf48
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions samples/cxl_host_exerciser/cxl_he_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bfecf48

Please sign in to comment.