Class DataRateCalculator
A memoryless data rate calculator and rate limiter.
Inheritance
System.Object
DataRateCalculator
Namespace: Sensus.Probes
Assembly: SensusAndroid.dll
Syntax
public class DataRateCalculator : Object
Constructors
DataRateCalculator(Int64, Nullable<Double>)
Declaration
public DataRateCalculator(long sampleSize, Nullable<double> maxSamplesToKeepPerSecond = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | sampleSize | |
System.Nullable<System.Double> | maxSamplesToKeepPerSecond |
Fields
DATA_RATE_EPSILON
Declaration
public const float DATA_RATE_EPSILON = 1E-08F
Field Value
Type | Description |
---|---|
System.Single |
Properties
SampleSize
Declaration
public long SampleSize { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
Add(Datum)
Add the specified datum to the data rate calculation. You must call Start(Nullable<DateTimeOffset>) before calling this method.
Declaration
public DataRateCalculator.SamplingAction Add(Datum datum)
Parameters
Type | Name | Description |
---|---|---|
Datum | datum | Datum to add. |
Returns
Type | Description |
---|---|
DataRateCalculator.SamplingAction | DataRateCalculator.SamplingAction indicating whether the Datum should be kept (Keep) or dropped (Drop) to meet the Sensus.Probes.DataRateCalculator._maxSamplesToKeepPerSecond requirement. |
GetDataPerSecond()
Declaration
public Nullable<double> GetDataPerSecond()
Returns
Type | Description |
---|---|
System.Nullable<System.Double> |
Start(Nullable<DateTimeOffset>)
Start the data rate calculation. Must be called prior to calling Add(Datum).
Declaration
public void Start(Nullable<DateTimeOffset> startTimestamp = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTimeOffset> | startTimestamp | Start timestamp. If null, the current time will be used. |