?
=?ISO-8859-1?Q?=D8ivind_Berentsen?=
Hi,
I'm experiencing some trouble when trying to access the "System\System
Up Time" performance counter. I used the following code:
PerformanceCounter pc = new PerformanceCounter("System", "System Up
Time", true);
pc.NextValue();
float seconds = pc.NextValue();
The code works perfectly on my development PC, running Windows XP SP2.
My XP embedded image is also SP2 and I've included the Performance
Counter Configuration component and resolved all dependencies.
I get the following exception information when trying to execute the code:
Unhandled Exception: System.TypeInitializationException: The type
initializer for "MPM.Common.TickClock" threw an except
ion. ---> System.InvalidOperationException: Category does not exist.
at System.Diagnostics.PerformanceCounterLib.CounterExists(String
machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, String instanceName, Boolean
readOnly)
at System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, Boolean readOnly)
at MPM.Common.TickClock..ctor() in
d:\software\common\common\tickclock.cs:line 22
at MPM.Common.TickClock..cctor() in
d:\software\common\common\tickclock.cs:line 18
--- End of inner exception stack trace ---
I've successfully connected to the XPe computer with the System Monitor
from my development PC.
If anyone has any information on how to get the "System Up Time" counter
working, or can point me in the right direction it would be much
appreciated!
Cheers,
Øivind Berentsen
I'm experiencing some trouble when trying to access the "System\System
Up Time" performance counter. I used the following code:
PerformanceCounter pc = new PerformanceCounter("System", "System Up
Time", true);
pc.NextValue();
float seconds = pc.NextValue();
The code works perfectly on my development PC, running Windows XP SP2.
My XP embedded image is also SP2 and I've included the Performance
Counter Configuration component and resolved all dependencies.
I get the following exception information when trying to execute the code:
Unhandled Exception: System.TypeInitializationException: The type
initializer for "MPM.Common.TickClock" threw an except
ion. ---> System.InvalidOperationException: Category does not exist.
at System.Diagnostics.PerformanceCounterLib.CounterExists(String
machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, String instanceName, Boolean
readOnly)
at System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, Boolean readOnly)
at MPM.Common.TickClock..ctor() in
d:\software\common\common\tickclock.cs:line 22
at MPM.Common.TickClock..cctor() in
d:\software\common\common\tickclock.cs:line 18
--- End of inner exception stack trace ---
I've successfully connected to the XPe computer with the System Monitor
from my development PC.
If anyone has any information on how to get the "System Up Time" counter
working, or can point me in the right direction it would be much
appreciated!
Cheers,
Øivind Berentsen