There are a couple of questions here about how to monitor CPU usage, but I cannot get my code to display anything other than 0.
Can someone please take a look and let me know what I'm doing wrong?
PerformanceCounter perform = new PerformanceCounter("Processor", "% Processor Time", "_Total");
public string cpuTime()
{
return perform.NextValue() + "%";
}
public void cpuUtilization()
{
}
public String getCPUUtilization()
{
return cpuTime();
}