清除窗口读磁盘缓存

清除窗口读磁盘缓存

本文介绍了如何清空C#/清除窗口读磁盘缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我试图确定驱动器的读取速度,我可以codeA程序将文件写入到文件系统,然后阅读这些文件回来。不幸的是,这并没有给出一个准确的读取速度,因为Windows不磁盘读取高速缓存。

If I am trying to determine the read speed of a drive, I can code a routine to write files to a filesystem and then read those files back. Unfortunately, this doesn't give an accurate read speed because Windows does disk read caching.

有没有一种方法来刷新磁盘读取驱动器的缓存在C#/。NET(或者用Win32 API调用),这样我就可以不用这些被缓存从驱动器中直接读取文件?

Is there a way to flush the disk read cache of a drive in C# / .Net (or perhaps with Win32 API calls) so that I can read the files directly from the drive without them being cached?

推荐答案

为什么DIY?

如果你只需要确定驱动器的速度,并在学习如何刷新我真的没有兴趣/从.NET O缓冲区,你可能只使用从http://research.microsoft.com/barc/Sequential_IO/.它随机/顺序与模式和无缓冲冲洗。

If you only need to determine drive speed and not really interested in learning how to flush I/O buffers from .NET, you may just use DiskSpd utility from http://research.microsoft.com/barc/Sequential_IO/. It has random/sequential modes with and without buffer flushing.

该网页也有一些I / O相关的研究报告,你可能会发现有用的。

The page also has some I/O related research reports you might find useful.

这篇关于如何清空C#/清除窗口读磁盘缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 08:41