Performance counters read very slow for large number of instances -
02-22-2006
, 08:50 AM
I am working with an application, which creates a single performance category
containing a small number of counters, but adds a huge number of instances to
each counter.
As far as I can see, the time taken to read a single instance grows as more
instances are added. (I am guessing that the read is having to search a
collection of instances for the one it wants.)
I curently have around 2000 instances in each of the counters, and it is
taking me over one and a half seconds per instance to read the RawValue. (It
took millisecnds when I had ten instances per counter.)
Are there any more effiecient ways of readign values than using
System.Diagnostics.PerformanceCounter?
My code is pretty straight forward:
Private m_PerfCtrNumSkip As System.Diagnostics.PerformanceCounter
....
Me.m_PerfCtrNumSkip = New System.Diagnostics.PerformanceCounter
Me.m_PerfCtrNumSkip.CategoryName = "PI Advanced Computing Engine"
Me.m_PerfCtrNumSkip.MachineName = "."
Me.m_PerfCtrNumSkip.CounterName = "Number of skipped calculations"
Me.m_PerfCtrNumSkip.InstanceName = Me.m_PerfCtrName
....
Public ReadOnly Property NumSkipped() As Long
Get
Try
Return CLng(m_PerfCtrNumSkip.RawValue)
Catch ex As Exception
Throw New Exception(mc_ModuleName & ".NumExec.Get: Error reading
Performance Counter: ", ex)
End Try
End Get
End Property
--
Thanks,
Mike Reid |