part2 ver 0.8.0 line by line

This commit is contained in:
ClF3 2024-11-05 10:37:28 +08:00
parent 1d92c511b4
commit 583a23a507
1 changed files with 4 additions and 21 deletions

View File

@ -30,27 +30,10 @@ int main() {
clflush((ADDR_PTR)buf + i * 128);
}
for(int i = 0; i < WAIT_TIME; i++);
for(int i = 0; i < 64; i++) {
new_offset = (AVAR * offset + CVAR) % 1024;
if(offset == new_offset||offset-new_offset==1||offset-new_offset==-1) {
offset = (AVAR1 * offset + CVAR1) % 1024;
}
else {
offset = new_offset;
}
time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
if(time < CACHE_HIT_THRESHOLD) {
// clflush((ADDR_PTR)buf + offset * 128);
// for(int i = 0; i < WAIT_TIME; i++);
// new_time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
// if(new_time < CACHE_HIT_THRESHOLD) {
flag = offset;
index = i;
break;
// }
}
}
if(flag != -1) {
time = measure_one_block_access_time((ADDR_PTR)buf + j * 128);
if(time < CACHE_HIT_THRESHOLD) {
flag = j;
index = j;
break;
}
}