I want to try a high dcache miss rate in c code and change the associative or cache size let miss rate down....
I referenced the How to come up with a high cache miss rate example?
try this code and use gcc elf compiler -O1 -static > a.out
int main(void)
{
int i;
int n = 1000 * 1000;
int *block = malloc(n * sizeof(int));
for (i = 0; i < n / 10; i++) {
int ri = rand() % n;
block[ri] = 0;
}
return 0;
}
the most cpu.dcache.miss.rate is 0.19
How do I edit the code let dcache miss rate raise above 70% or 80%?