I am trying out some ways of measuring the TLB size on my machine. I somehow needed to ensure that the CPU does not cache the elements of the array I am using to measure the average access time per page. So I tried this code inside the loop that I have, using the answer over here:
FILE *fp;
fp = fopen("/proc/sys/vm/drop_caches", "w");
fprintf(fp, "3");
fclose(fp);
However, I am getting the Segmentation Fault (core dumped)
error. I have no idea why this could be happening. I am not very good with C and any help would be appreciated. Thanks.