modified following the tips

This commit is contained in:
ClF3 2024-11-04 15:33:53 +08:00
parent aa89420f1f
commit 18f0b76f2e
1 changed files with 10 additions and 3 deletions

View File

@ -11,7 +11,9 @@
#define L1_SIZE 768*1024
#define L2_SIZE 16*1024*1024
#define L3_SIZE 64*1024*1024
#define BUFF_SIZE 16*1024*1024
#define REDUNDANCY 2
#define BUFF_SIZE REDUNDANCY*16*1024*1024
#define REPEAT 10
int main (int ac, char **av) {
@ -69,10 +71,13 @@ int main (int ac, char **av) {
// Step 1: bring the target cache line into L1 by simply accessing
// the line
tmp = target_buffer[0];
for(int j=0; j<L1_SIZE/LINE_SIZE; j++){
for(int k=0; k<REPEAT; k++){
for(int j=0; j<REDUNDANCY*L1_SIZE/LINE_SIZE; j++){
tmp = eviction_buffer[j*LINE_SIZE];
}
}
// Step 2: measure the access latency
l2_latency[i] = measure_one_block_access_time((uint64_t)target_buffer);
}
@ -85,8 +90,10 @@ int main (int ac, char **av) {
// Step 1: bring the target cache line into L1 by simply accessing
// the line
tmp = target_buffer[0];
for(int j=0; j<L2_SIZE/LINE_SIZE; j++){
for(int k=0; k<REPEAT; k++){
for(int j=0; j<REDUNDANCY*L2_SIZE/LINE_SIZE; j++){
tmp = eviction_buffer[j*LINE_SIZE];
}
}
// Step 2: measure the access latency