views:

43

answers:

1

I need the memory usage and processing time for an application loaded through another application. I am using C#. Currently I am using Process.WorkingSet to get memory usage similarly Process.TotalProcessTime to get time for execution, but it doesn't give any value. So have you make any suggestions?

+1  A: 

Use WMI to get this kind of info, well supported by the System.Management namespace. Get started by downloading the WMI Code Creator utility, it lets you experiment with queries and can auto-generate the C# you'll need.

You want to query Win32_Process, it provides lots of info about a process. PrivatePageCount would be a good measure for the amount of memory it uses that isn't shared by any other process. KernelModeTime and UserModeTime gives you time spent executing code.

Hans Passant