CSharpTest.Net
CallsPerSecondCounter Class
Members  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Threading Namespace : CallsPerSecondCounter Class

Glossary Item Box

A low-precision, but fast, counter that estimates how often the Increment() method is being called on this instance. The precision is roughly +/- 1.7% for every 1000 calls/sec; so at 20000 calls/second expect the Value property to be +/- 34%. If you looking for something cheap to use to 'push-back' on overbearing clients this should suite most needs. If more accuracy is desired at higher volumes, specify the sampleFreq to scale the data samples under 1000/sec.

Syntax

Visual Basic (Declaration) 
Public Class CallsPerSecondCounter 
C# 
public class CallsPerSecondCounter 

Remarks

Yes you can build this with a Stopwatch.GetTimestamp() instead of DateTime.UtcNow; hoewever the Stopwatch API is 100x slower than using DateTime.UtcNow and although more precise, it generally does not provide significant gains in the sub 50k call range. Generally you can just increase sampleFreq to make up for the lack of precision in DateTime.UtcNow.

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Threading.CallsPerSecondCounter

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys