Chinaunix首页 | 论坛 | 博客
  • 博客访问: 616917
  • 博文数量: 486
  • 博客积分: 10125
  • 博客等级: 上将
  • 技术积分: 5842
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-27 18:34
文章分类

全部博文(486)

文章存档

2011年(52)

2010年(107)

2009年(289)

2008年(38)

我的朋友

分类: LINUX

2008-11-05 18:59:33

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
阅读(442) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~