linux下清空磁盘缓存
测试程序性能的时候,之前的时候需要不停的重启机器来进行测试,比较麻烦,想有什么办法可以清空磁盘缓存呢?
If you're on OS X, the 'purge' command (part of the CHUD developer
tools) will cause the disk caches to be purged. On Linux, with a 2.6.16
kernel or newer, 'echo 3 > /proc/sys/vm/drop_caches' will achieve
the same effect. Another trick on Linux is to use a separate filesystem
for the benchmark--if you perform a umount/mount cycle
after each run
the kernel will drop any cached data that came from that filesystem.
两种方法:
echo 3 > /proc/sys/vm/drop_caches
umount /dev/sdx
参考:
http://www.gamedev.net/community/forums/topic.asp?topic_id=402069
http://blog.chinaunix.net/u/27173/showart_467689.html
from:http://blog.chinaunix.net/u/12592/showart.php?id=1332741
阅读(470) | 评论(0) | 转发(0) |