开发者

How can I find hard disk speed

How can I find hard disk speed? I can not use 开发者_JAVA百科System.IO.File.Copy and use timer to get hard disk speed, because after caching file, the speed will be really higher than real time.

What can I do instead?


The reason the subsequent read speed is much higher than expected after writing a file, is that the file is cached by the OS in the disk system cache when it is written i.e. in-memory. The subsequent file read is in effect being read from memory, rather than disk.

Please see this code project article which provides a solution for bypassing the OS disk cache by leveraging the FILE_FLAG_NO_BUFFERING flag:

http://www.codeproject.com/KB/files/unbuffered.aspx

This solution can be used in your context to avoid OS disk caching, and so obtain "real" disk speeds.


You are asking about "real time". Since in real case cache is in use, I don't see any problems. You might like to use some script or similar to run your program instead of some File.Copy or other simpler tests.

But the real question is, what then? I.e. are you trying to find out if some disk is fast enough or are you trying to find out if your program is fast enough?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜