0

is it possible to track the cpu utilisation per module in a process? In below code can CPU and memory consumption for each module in myProcess.Modules be determined?

Process[] currentProcesses = Process.GetProcesses();
Process myProcess = currentProcesses[0];

using (PerformanceCounter pcProcess = new PerformanceCounter(
    "Process", 
    "% Processor    Time", 
    targetProcess.ProcessName))
using (PerformanceCounter memProcess = new PerformanceCounter(
    "Process",   
    "Working Set - Private",
    targetProcess.ProcessName))
{
    pcProcess.NextValue();
}
RB.
  • 36,301
  • 12
  • 91
  • 131
DenizEng
  • 400
  • 4
  • 14
  • 1
    That's not possible, you need to use a profiler. – Hans Passant Feb 19 '13 at 15:07
  • I've used windows performance analyzer, which provides the required module level CPU usage data, but the issue is, I'd like to automate this process and retrieve module level statistics for a single process and the WPA recordings even for 1 minute create ETL files larger than 1GB. Is it possible to use WPA to record profile data only for a single process, to keep the ETL file size small? – DenizEng Feb 19 '13 at 15:21

0 Answers0