HighTechTalks DotNet Forums  

Performance cost of custom counters

Dotnet Framework (Performance) microsoft.public.dotnet.framework.performance


Discuss Performance cost of custom counters in the Dotnet Framework (Performance) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Rick Spiewak
 
Posts: n/a

Default Performance cost of custom counters - 09-29-2005 , 03:17 PM






Is there any general guidance concerning the cost of using custom counters?
My experiments show the overhead to be extremely low, but they may be
distorted by JIT optimization or caching or...

Are there any existing published guidelines on this subject?

TIA.


Reply With Quote
  #2  
Old   
john conwell
 
Posts: n/a

Default RE: Performance cost of custom counters - 10-07-2005 , 12:20 PM






Just using the perf counters in general will give you a fairly significant
performance hit. When integrate custom perf counters into my app, i always
have a way to turn them on and off, usually with a BooleanSwitch object being
set in the config file.

Under normal production execution your app should not use, write or read,
any perf counters. you should just have a troubleshooting flag you can turn
on and off. That way you only get the perf hit when you explicitly want to
trouble shoot.


"Rick Spiewak" wrote:

Quote:
Is there any general guidance concerning the cost of using custom counters?
My experiments show the overhead to be extremely low, but they may be
distorted by JIT optimization or caching or...

Are there any existing published guidelines on this subject?

TIA.


Reply With Quote
  #3  
Old   
Rick Spiewak
 
Posts: n/a

Default RE: Performance cost of custom counters - 10-07-2005 , 12:55 PM



That seems to be the general opinion. I decided to do a simple test,
comparing the time of a loop with and without incrementing two counters (one
absolute, one a rate counter). Over 10,000,000 iterations, the time
difference was 225 microseconds! While this is almost certainly an artifact
due to caching of the loop, it still suggests that the actuall overhead of
Windows performance counters used via .NET is minimal. It almost looks like
the impact should approximate that of doing the boolean test to decide
whether to use the counter. The fact that Windows itself contains large
numbers of counters seems to indicate that there is little impact.

Do you have an example which shows otherwise?

"john conwell" wrote:

Quote:
Just using the perf counters in general will give you a fairly significant
performance hit. When integrate custom perf counters into my app, i always
have a way to turn them on and off, usually with a BooleanSwitch object being
set in the config file.

Under normal production execution your app should not use, write or read,
any perf counters. you should just have a troubleshooting flag you can turn
on and off. That way you only get the perf hit when you explicitly want to
trouble shoot.


"Rick Spiewak" wrote:

Is there any general guidance concerning the cost of using custom counters?
My experiments show the overhead to be extremely low, but they may be
distorted by JIT optimization or caching or...

Are there any existing published guidelines on this subject?

TIA.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.