
05-26-2009, 11:30 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Nebraska, USA
Posts: 640
|
|
PerformanceCounter taking 40-50 seconds to be created
|
Ok, need to ask because this is driving me nuts now.
I have a performance counter set up to pull % Processor Time on a remote machine.
Heres the code I use to pull it:
Code:
Private cpuCounter As PerformanceCounter = Nothing
Try
cpuCounter = New PerformanceCounter("Processor", "% Processor Time", "_Total", strServer)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
However, sometimes it can take 40-50 seconds for this one counter to process.. when its been created (the 'cpuCounter =' line), then it runs just fine, I can pull nextvalue without any problem.. but creating it takes forever.
This only happens the first time I run my program and it only happens with the first counter, and it doesn't ALWAYS happen.
Any idea how I can try and track down whats holding me up here? All the other counters are fine, its just the first one.. am I missing some log-in step or something?
Thanks
|
|