D
Dirk Reske
Hello,
I have following code:
I have following code:
foreach (string instance in cat.GetInstanceNames())
{
PerformanceCounter counter =
new PerformanceCounter("Process","%Processor Time",instance);
this.listBox1.Items.Add(instance + ":" + counter.NextValue());
}
why does counter.NextValue() allways returns 0??
Bjorn Abelli said:...
foreach (string instance in cat.GetInstanceNames())
{
PerformanceCounter counter =
new PerformanceCounter("Process","%Processor Time",instance);
this.listBox1.Items.Add(instance + ":" + counter.NextValue());
}
why does counter.NextValue() allways returns 0??
"If the calculated value of a counter depends on two counter reads, the
first read returns 0.0." [from documentation]
Perhaps you're really looking for counter.RawValue?
// Bjorn A