Try to read big data regularly through the CPU (i.e. not DMA). How:
int main() { const int size = 20*1024*1024; // Allocate 20M. Set much larger then L2 char *c = (char *)malloc(size); for (int i = 0; i < 0xffff; i++) for (int j = 0; j < size; j++) c[j] = i*j; }
However, depending on the server, the big problem may be the disk cache (in memory), and then the L1 / L2 cache. On Linux (for example), using:
sync echo 3 > /proc/sys/vm/drop_caches
Edit: It is trivial to create a large program that does nothing:
#!/usr/bin/ruby puts "main:" 200000.times { puts " nop" } puts " xor rax, rax" puts " ret"
Running several times under different names (code not created with a script) should do the job
source share