[ACCEPTED]-How to know the CPU and memory usage of a process with WMI?-wmi
I'm pretty sure you want the WMI perf classes Win32_PerfFormattedData_PerfProc_Process or Win32_PerfRawData_PerfProc_Process
E.g. their 4 properties PercentProcessorTime and WorkingSet
Note that the Perf classes 3 take a bit effort to understand.
- There are gotchas with the Formatted versions (See Hey, Scripting Guy! article Why Does My Performance Monitoring Script Keep Returning the Same Incorrect Values?)
- And the Raw Data classes need care to translate the "CounterType" into the right math formula to use to calculate the values based on the raw data. See How's My Driving? Monitoring Performance Using WMI for a starting place.
But those 2 WMI classes should give you all the info 1 you're looking for.
Might also be of interest:
Win32_Process also has UserModeTime and 2 KernelModeTime which can be used to calculate 1 CPU usage
Also look at http://technet.microsoft.com/en-us/library/ee176718.aspx
More Related questions