Performance Counters always returns 0, 50 or 100.
-
I intend to show CPU time on a Dundas Gauge Control. So i get the CPU time; but the value is always return 0; i survived the fd from 0 but now it returns 50 sometimes 100. but if i check the
CPU_1PerformanceCounter.NextValue();
on Quick Watch i see the reel values. if i press the REGENERATE button; it returns new reel value but
fd = CPU_1PerformanceCounter.NextValue();
never works; so it is not set the reel value to my fd variable.
//CPU Counters
PerformanceCounter CPU_TotalPerformanceCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
float fd = 0;
do
{
fd = CPU_1PerformanceCounter.NextValue();
} while (fd == 0);e.RealTimeValues.Add("CPU_Total", fd);
-
I intend to show CPU time on a Dundas Gauge Control. So i get the CPU time; but the value is always return 0; i survived the fd from 0 but now it returns 50 sometimes 100. but if i check the
CPU_1PerformanceCounter.NextValue();
on Quick Watch i see the reel values. if i press the REGENERATE button; it returns new reel value but
fd = CPU_1PerformanceCounter.NextValue();
never works; so it is not set the reel value to my fd variable.
//CPU Counters
PerformanceCounter CPU_TotalPerformanceCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
float fd = 0;
do
{
fd = CPU_1PerformanceCounter.NextValue();
} while (fd == 0);e.RealTimeValues.Add("CPU_Total", fd);
You may like to check out http://www.dotnet247.com/247reference/msgs/21/105927.aspx[^] as it outlines a similar issue and discusses a few workarounds.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... --William Shakespeare