Get information about running processes
I need to start a monitor on some machines to find out which processes are locking it. So what I would like is logging about the same information you can find on the Task Manager about each executing process.
So far I can have the Processor Time information with the C# Process Class, but I would also like to know how much memory it is using. Also would be very useful to see if a given application or a process is " Not R开发者_开发技巧esponding". Any ideas about how to get all that info. ( might the System.Events help as well?)I agree with Nick, WMI is your best bet for detailed process info.
But there is also something that you may be interested in, Powershell (ships with Windows 7 and available as download for other OS's) not only supports WMI but presents the WMI artifacts as Objects that you can subsuqently run linq queries over - pipeline into other powershell calls etc, its also completely programable and/or scriptable, it's very cool tech, well worth learning....but...it's a reasonable investment of time to learn.
Power shell Msdn site
I think your best bet is to use WMI and get all the instances of the Win32_Process class. You can get all of the Win32_Process instances using the ManagementObjectSearcher.
精彩评论