public void TestInitial() { var ema = new ExponentialMovingAverage(10); ema.Add(3); Assert.That(ema.Value, Is.EqualTo(3)); Assert.That(ema.Var, Is.EqualTo(0)); }
public static void Reset() { stopwatch.Restart(); _rtt = new ExponentialMovingAverage(PingWindowSize); _offset = new ExponentialMovingAverage(PingWindowSize); offsetMin = double.MinValue; offsetMax = double.MaxValue; lastPingTime = 0; }
public void TestVar() { var ema = new ExponentialMovingAverage(10); ema.Add(5); ema.Add(6); ema.Add(7); Assert.That(ema.Var, Is.EqualTo(0.6134).Within(0.0001f)); }
public void TestMovingAverage() { var ema = new ExponentialMovingAverage(10); ema.Add(5); ema.Add(6); Assert.That(ema.Value, Is.EqualTo(5.1818).Within(0.0001f)); Assert.That(ema.Var, Is.EqualTo(0.1487).Within(0.0001f)); }
public static void ResetStatics() { PingFrequency = 2.0f; PingWindowSize = 10; lastPingTime = 0; _rtt = new ExponentialMovingAverage(PingWindowSize); _offset = new ExponentialMovingAverage(PingWindowSize); offsetMin = double.MinValue; offsetMax = double.MaxValue; stopwatch.Restart(); }
public static void Reset(int windowSize) { _rtt = new ExponentialMovingAverage(windowSize); _offset = new ExponentialMovingAverage(windowSize); }