日期:2014-05-17  浏览次数:21018 次

C# 如何获取磁盘IO速率
获取CPU使用率可以用new PerformanceCounter("Processor", "% Processor Time", "_Total");获得,获取磁盘IO速率该如何获取呢?

------解决方案--------------------
http://social.msdn.microsoft.com/Forums/en-US/37b8b63a-da32-4497-b570-3811a2255dee/how-to-get-disk-io-countersdisk-write-time-disk-read-time-using-cnet?forum=csharplanguage

            this.diskReadsPerformanceCounter.CategoryName = "PhysicalDisk"; 
            this.diskReadsPerformanceCounter.CounterName = "Disk Reads/sec"; 
            this.diskReadsPerformanceCounter.InstanceName = "_Total"; 
 
            this.diskWritesPerformanceCounter.CategoryName = "PhysicalDisk"; 
            this.diskWritesPerformanceCounter.CounterName = "Disk Writes/sec"; 
            this.diskWritesPerformanceCounter.InstanceName = "_Total";