我如何才能找到硬盘速度 [英] How can I find hard disk speed
问题描述
我如何才能找到硬盘速度?我不能使用 System.IO.File.Copy
并使用定时器来获得硬盘的速度,因为缓存文件之后,速度会比真正的实时高。
How can I find hard disk speed? I can not use 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.
我能做些什么呢?
推荐答案
究其原因,后续的读取速度是高得多的写入文件后比预期的是,该文件是通过在当它在存储器即写入的磁盘系统缓存操作系统缓存。后续文件的读取是有效从内存中读取,而不是磁盘。
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.
请查看此代码项目的文章提供了一个解决方案,通过利用绕过操作系统磁盘缓存 FILE_FLAG_NO_BUFFERING 标志:
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.
这篇关于我如何才能找到硬盘速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!