public static CalculateAlpha ( System.TimeSpan halfLife, System.TimeSpan collectInterval ) : double | ||
halfLife | System.TimeSpan | |
collectInterval | System.TimeSpan | |
return | double |
public static double CalculateAlpha(TimeSpan halfLife, TimeSpan collectInterval)
{
var halfLifeMillis = halfLife.TotalMilliseconds;
if (halfLifeMillis < 0) throw new ArgumentOutOfRangeException("halfLife", "halfLife must be > 0s");
var decayRate = LogOf2 / halfLifeMillis;
return 1 - Math.Exp(-decayRate * collectInterval.TotalMilliseconds);
}
private PerformanceCounterMetricsCollector(Cluster cluster) : this(cluster.SelfAddress, EWMA.CalculateAlpha(cluster.Settings.MetricsMovingAverageHalfLife, cluster.Settings.MetricsInterval)) { }