简体   繁体   English

hdparm和磁盘读取速度

[英]hdparm and disk read speed

My hdparm -t buffered disk reads output is around 120 MB/sec. 我的hdparm -t缓冲磁盘读取输出约为120 MB /秒。 However, I was writing a little code that involves reading a big file (around 400MB), when I managed to read it all in about one second ( fread() on c ). 但是,当我设法在大约一秒钟的时间内读取所有文件时,我正在编写一个涉及读取大文件(约400MB)的小代码fread() c上的fread() )。 Does the hdparm output not quite say what I understand? hdparm输出不完全说明我的理解吗? Why am I able to read so much faster? 为什么我读得这么快?

I do very simple processing to the bytes I read, counting how many are the letter 'A'. 我对读取的字节进行了非常简单的处理,计算了字母“ A”的个数。

hdparm is bypassing your OS's cache, but your test program is taking advantage of it. hdparm绕过了操作系统的缓存,但是您的测试程序正在利用它。 Presuming you're running Linux, evict everything from the page cache with this command (source: http://linux-mm.org/Drop_Caches ): 假设您正在运行Linux,请使用以下命令从页面缓存中退出所有内容(来源: http : //linux-mm.org/Drop_Caches ):

echo 3 > /proc/sys/vm/drop_caches

Then, run your test program. 然后,运行您的测试程序。 It should be at or below the rate reported by hdparm. 该速率应等于或低于hdparm报告的速率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM