Clear file cache to repeat performance testing
A command line utility can be found here
from source:
EmptyStandbyList.exe
is a command line tool for Windows (Vista and above) that can empty:
- process working sets,
- the modified page list,
- the standby lists (priorities 0 to 7), or
- the priority 0 standby list only.
Usage:
EmptyStandbyList.exe workingsets|modifiedpagelist|standbylist|priority0standbylist
A quick googling gives these options for Linux
- Unmount and mount the partition holding the files
sync && echo 1 > /proc/sys/vm/drop_caches
Use SysInternal's RAMMap app.
The Empty / Empty Standby List menu option will clear the Windows file cache.
For Windows XP, you should be able to clear the cache for a specific file by opening the file using CreateFile with the FILE_FLAG_NO_BUFFERING options and then closing the handle. This isn't documented, and I don't know if it works on later versions of Windows, but I used this long ago when writing test code to compare file compression libraries. I don't recall if read or write access affected this trick.