how to get CPU usage of inidividual process in VB.NET

  • Thread starter Thread starter Shan Yong
  • Start date Start date
S

Shan Yong

I am trying to monitor the CPU usage of a particualar process in
VB.NET, and the best that I can come up with is get the TotalProcessor
time using the System.Diagnostic.Process object.

Is there an easy way to do this?

Thanks,
 
You could also use performance counters. Drag a performance counter component
from the 'Components' toolbox on to your form. Set the CategoryName to 'Process',
CounterName to '% Processor Time' and InstanceName to the process you want
to monitor. This should give you the CPU usage for the process you've set
as the InstanceName. Note that you can do all this stuff from code as well.
You can change the instance name based on the process you want to monitor.

Apart from this, you can also look into doing this with WMI though I haven't
looked into it myself.

hope that helps..
Imran.
 
Back
Top