G
Guest
I am using the following code to get the CPU usage
PerformanceCounter myCounter;
myCounter = new PerformanceCounter();
myCounter.CategoryName = "Processor";
myCounter.CounterName = "% Processor Time";
myCounter.InstanceName = "_Total";
for(int i=0; i < 20; i++)
myCounter.NextValue();
I ran this progam i am seeing values 0 or 100%, but when i see the task
manager the CPU usage is 6 to 22 %.
Am i missing something
PerformanceCounter myCounter;
myCounter = new PerformanceCounter();
myCounter.CategoryName = "Processor";
myCounter.CounterName = "% Processor Time";
myCounter.InstanceName = "_Total";
for(int i=0; i < 20; i++)
myCounter.NextValue();
I ran this progam i am seeing values 0 or 100%, but when i see the task
manager the CPU usage is 6 to 22 %.
Am i missing something