OpenSim
|
Collects metrics in a sliding window. More...
Public Member Functions | |
MetricsCollector (int windowSize, int numBuckets) | |
Creates a MetricsCollector. More... | |
void | Reset () |
void | AddSample (T sample) |
T | GetSum () |
Returns the total values in the collection window. More... | |
Protected Member Functions | |
abstract T | GetZero () |
Returns the default (zero) value. More... | |
abstract T | Add (T a, T b) |
Adds two values. More... | |
Collects metrics in a sliding window.
MetricsCollector provides the current Sum of the metrics that it collects. It can easily be extended to provide the Average, too. It uses a sliding window to keep these values current.
This class is not thread-safe.
Subclass MetricsCollector to have it use a concrete value type. Override the abstract methods.
Definition at line 64 of file MetricsCollector.cs.
|
inline |
Creates a MetricsCollector.
windowSize | The period of time over which to collect the metrics, in ms. E.g.: 30,000. |
numBuckets | The number of buckets to divide the samples into. E.g.: 10. Using more buckets smooths the jarring that occurs whenever we drop an old bucket, but uses more memory. |
Definition at line 99 of file MetricsCollector.cs.
|
protectedpure virtual |
Adds two values.
|
inline |
Definition at line 114 of file MetricsCollector.cs.
|
inline |
Returns the total values in the collection window.
Definition at line 129 of file MetricsCollector.cs.
|
protectedpure virtual |
|
inline |
Definition at line 106 of file MetricsCollector.cs.