Skip to content

Commit

Permalink
fix: update CXL Host exerciser latency calculations (#3088)
Browse files Browse the repository at this point in the history
-CXL Host exerciser latency calculations  equation by consider the penalty start i.e.
    B asically consider total clock cycles – penalty clock cycles for calculation instead of total cycles that comes in DSM.

    Latency nano seconds  =  (number of ticks – penalty start ticks ) * 2.5

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
  • Loading branch information
anandaravuri committed Jan 23, 2024
1 parent 5ddcefa commit 4eb84e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 6 additions & 6 deletions samples/cxl_host_exerciser/cxl_he_cache_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ class he_cache_cmd : public he_cmd {
return -1;
}

total_latency = total_latency + get_ticks();
total_latency = total_latency + get_ticks() - get_penalty_start_ticks();
host_exe_->logger_->info("Iteration: {0} Latency: {1:0.3f} nanoseconds",
i, (double)(get_ticks() * LATENCY_FACTOR));
i, (double)((get_ticks()- get_penalty_start_ticks()) * LATENCY_FACTOR));
} //end for loop

total_latency = total_latency * LATENCY_FACTOR;
Expand Down Expand Up @@ -556,9 +556,9 @@ class he_cache_cmd : public he_cmd {
return -1;
}

total_latency = total_latency + get_ticks();
total_latency = total_latency + get_ticks() - get_penalty_start_ticks();
host_exe_->logger_->info("Iteration: {0} Latency: {1:0.3f} nanoseconds",
i, (double)(get_ticks() * LATENCY_FACTOR));
i, (double)((get_ticks() - get_penalty_start_ticks() ) * LATENCY_FACTOR));
} //end for loop

total_latency = total_latency * LATENCY_FACTOR;
Expand Down Expand Up @@ -793,9 +793,9 @@ class he_cache_cmd : public he_cmd {
return -1;
}

total_latency = total_latency + get_ticks();
total_latency = total_latency + get_ticks() - get_penalty_start_ticks();
host_exe_->logger_->info("Iteration: {0} Latency: {1:0.3f} nanoseconds",
i, (double)(get_ticks() * LATENCY_FACTOR));
i, (double)((get_ticks() - get_penalty_start_ticks() ) * LATENCY_FACTOR));
} //end for loop

total_latency = total_latency * LATENCY_FACTOR;
Expand Down
13 changes: 13 additions & 0 deletions samples/cxl_host_exerciser/cxl_he_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,19 @@ class he_cmd : public test_command {
return 0;
}

uint64_t get_penalty_start_ticks() {
volatile he_cache_dsm_status* dsm_status = NULL;

dsm_status = reinterpret_cast<he_cache_dsm_status*>(
(uint8_t*)(host_exe_->get_dsm()));
if (!dsm_status)
return 0;
if (dsm_status->penalty_start > 0)
return dsm_status->penalty_start;
else
return 0;
}

int get_mtime(const char* file_name, struct timespec* mtime)
{
struct stat s;
Expand Down

0 comments on commit 4eb84e9

Please sign in to comment.