コード例 #1
0
 /// <summary>
 /// Clears all recorded values
 /// </summary>
 public void Clear(long timestamp)
 {
     _lastTick = timestamp;
     _uncounted.Set(0);
     _rate.Set(0);
     _initialized = false;
 }
コード例 #2
0
        /// <summary>
        /// Mark the passage of time and decay the current rate accordingly.
        /// </summary>
        public void Tick()
        {
            var count       = _uncounted.GetAndSet(0);
            var instantRate = count / _interval;

            if (_initialized)
            {
                _rate += _alpha * (instantRate - _rate);
            }
            else
            {
                _rate.Set(instantRate);
                _initialized = true;
            }
        }
コード例 #3
0
ファイル: EWMA.cs プロジェクト: t9mike/vault
 /// <summary>
 /// Clears all recorded values
 /// </summary>
 public void Clear()
 {
     _uncounted.Set(0);
     _rate.Set(0);
     _initialized = false;
 }