CVB.Net 14.0
RateCounter Class Reference

Frame Rate Measurement counter with selectable averaging window. More...

Public Member Functions

 RateCounter (int windowSize, StopWatchMode mode)
 Constructor for an FpsCounter object. More...
 
 RateCounter (int windowSize)
 Constructor for an FpsCounter object. More...
 
 RateCounter ()
 Constructor for an FpsCounter object with default averaging window size.
 
void Reset ()
 Erase all measurements so far.
 
void Step ()
 Reading step (first reading step will not yield a measurement result but define the starting point).
 

Static Public Attributes

const int DefaultWindowSize = 25
 Default averaging window size.
 
const int MinimumWindowSize = 1
 Minimal selectable averaging window size. Trying to select a smaller window will result in an exception.
 
const int MaximumWindowSize = 65535
 Maximum selectable averaging window size. Trying to select a larger window will result in an exception.
 

Properties

StopWatchMode Mode [get]
 The StopWatchMode used internally.
 
int WindowSize [get, set]
 Currently used averaging window size. More...
 
UsTimeSpan AverageTimeSpan [get]
 Average time span between two Step calls since the creation of the counter or the most recent call to Reset.
 
double Rate [get]
 Returns the rate (1/s) at which the calls to Step occurred.
 
long NumSteps [get]
 Number of Step called since construction or since last call to Reset.
 

Detailed Description

Frame Rate Measurement counter with selectable averaging window.

Constructor & Destructor Documentation

◆ RateCounter() [1/2]

RateCounter ( int  windowSize,
StopWatchMode  mode 
)

Constructor for an FpsCounter object.

Parameters
windowSizeAveraging window (i.e. number of measurements over which to average).
modeStopWatchMode to be used. See enum values for details.

◆ RateCounter() [2/2]

RateCounter ( int  windowSize)

Constructor for an FpsCounter object.

Parameters
windowSizeAveraging window (i.e. number of measurements over which to average).

Property Documentation

◆ WindowSize

int WindowSize
getset

Currently used averaging window size.

Exceptions
ArgumentOutOfRangeExceptionIf the value to be set exceeds the range [MinimumWindowSize...MaximumWindowSize].