Not the one that works "for everything, everywhere." Most processors have special instructions for clearing the cache, but they are often privileged instructions, so they must be done from within the OS kernel, and not from user mode code. And of course, these are completely different instructions for each processor architecture.
All current x86 processors have an instruction clflushthat flushes one cache line, but for this you need to have the address of the data (or code) that you want to flush. This is great for small and simple data structures, not so good if you have a binary tree that is everywhere. And, of course, not portable at all.
In most environments, reading and writing a large block of alternative data, for example. sort of:
const size_t bigger_than_cachesize = 10 * 1024 * 1024;
long *p = new long[bigger_than_cachesize];
...
for(int i = 0; i < bigger_than_cachesize; i++)
{
p[i] = rand();
}
rand , - /. , , () , .
- , , ( ) , . , ( perforamnce, , , , , , , )
" " - , , , , .
, " " , " ", . , , , ...