4

I need to extract disk statistics for a given process, I can get the processes listed and get overall information such as CPU and Memory listed using WMI and PerformanceCounters. But the information is all bundled up, is there any way to extract those data per process. Kind of like in Windows Resource Monitor?

Thanks in Advance

Ceilingfish
  • 5,397
  • 4
  • 44
  • 71
tharindus609
  • 59
  • 2
  • 8
  • Not sure if this is useful, but could give it a try; http://msdn.microsoft.com/en-us/library/2fh4x1xb%28vs.71%29.aspx – Martijn Hols Feb 25 '14 at 19:25
  • It's performance counters - you should be quite easily able to get the overall IO rate (which is disk + net + driver IO). I don't have the route for getting it split out into the different categories - I would hazard a guess that the same method as is used in process explorer, and so is at least a bit of effort. – Anya Shenanigans Feb 25 '14 at 19:47
  • Although reading a bit more, it's most likely Windows Performance Analyzer (WPA) using `EVENT_TRACE_FLAG_DISK_IO` and `EVENT_TRACE_FLAG_DISK_FILE_IO` and mapping back the `IssuingThreadId` to the process that requested it. – Anya Shenanigans Feb 25 '14 at 19:55
  • @Petesh I can single out the disk IO rates. what i'm having trouble is in getting those data rates per system process. I'm also looking into WPA as well thanks for that... – tharindus609 Feb 26 '14 at 09:03
  • @MartijnHols Thank you very much for that... But still the data is and overall read of the disk.. – tharindus609 Feb 26 '14 at 09:08

1 Answers1

2

If you need live data, you should implement ETW listener.

ETW are the way of tracing performance information in Windows. It is supported back to Windows 2000.

Every component in Windows report ETW events (if there is a listener waiting for data).

For example, Disk info, memory (consumption, page faults, etc..), contention, CPU usage (per core, per thread, per application, even single IO requests to the disk or the network. Drivers uses it, .NET CLR uses it (get JIT or GC stats), and the examples are endless.

I suggest you will start with downloading XPerf\Xperf view, or Windows Performance Recorder + Analyzer, PerfView, try to see what information exactly are you looking for, and then start creating your Managed ETW listener.

You can start with this blog post, or search for ETW posts by Vans Morison (which is in charge of the Managed ETW Providers and Consumers in MS).

Hope this helps, Ofir.

Ofir Makmal
  • 501
  • 2
  • 3
  • Thank you soo much i was able to extract some data through WPA. I finished a windows only solution couple months back i'm trying to make the solution more cross-platform. I will try and use this method on it. – tharindus609 Jun 08 '14 at 09:05