开发者

Monitor disk activity programmatically (Windows)

开发者 https://www.devze.com 2022-12-26 08:23 出处:网络
In Windows 2008R2, in Resource Monitor in the Disk Activity section I can see the number of bytes read fr开发者_StackOverflow中文版om/written into files. How can I do this in a programmatic manner, pr

In Windows 2008R2, in Resource Monitor in the Disk Activity section I can see the number of bytes read fr开发者_StackOverflow中文版om/written into files. How can I do this in a programmatic manner, preferably using C# (or Win32 API)? I have looked into WMI and various performance counters, however I cannot figure out if there is something which suits my needs.


The counters relating to file I/O are on the LogicalDisk and PhysicalDisk objects. Take a look in Perfmon to see what counters are available.

Use the PerformanceCounter class in C# or the PDH API in C/C++. In my experience these are much more efficient than WMI - though this may not matter in your application.

0

精彩评论

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