protected override object UpdateAggregate_Stage1(MetricValuesBufferBase <double> buffer, int minFlushIndex, int maxFlushIndex) { // Compute a summary of the buffer: Data bufferData = new Data(); bufferData.HasValues = false; bufferData.Min = Double.MaxValue; bufferData.Max = Double.MinValue; bufferData.Last = Double.NaN; for (int index = minFlushIndex; index <= maxFlushIndex; index++) { double metricValue = buffer.GetAndResetValue(index); if (Double.IsNaN(metricValue)) { continue; } bufferData.HasValues = true; bufferData.Max = (metricValue > bufferData.Max) ? metricValue : bufferData.Max; bufferData.Min = (metricValue < bufferData.Min) ? metricValue : bufferData.Min; bufferData.Last = metricValue; } return(bufferData); }
protected override object UpdateAggregate_Stage1(MetricValuesBufferBase <object> buffer, int minFlushIndex, int maxFlushIndex) { lock (_updateLock) { for (int index = minFlushIndex; index <= maxFlushIndex; index++) { object metricValue = buffer.GetAndResetValue(index); if (metricValue == null) { continue; } string stringValue = metricValue.ToString(); if (!_caseSensitive) { stringValue = stringValue.ToLowerInvariant(); } _uniqueValues.Add(stringValue); Interlocked.Increment(ref _totalValuesCount); } } return(null); }
protected override object UpdateAggregate_Stage1(MetricValuesBufferBase <double> buffer, int minFlushIndex, int maxFlushIndex) { Data bufferData = new Data(); bufferData.Count = 0; bufferData.Min = Double.MaxValue; bufferData.Max = Double.MinValue; bufferData.Sum = 0.0; bufferData.SumOfSquares = 0.0; for (int index = minFlushIndex; index <= maxFlushIndex; index++) { double metricValue = buffer.GetAndResetValue(index); if (Double.IsNaN(metricValue)) { continue; } bufferData.Count++; bufferData.Max = (metricValue > bufferData.Max) ? metricValue : bufferData.Max; bufferData.Min = (metricValue < bufferData.Min) ? metricValue : bufferData.Min; bufferData.Sum += metricValue; bufferData.SumOfSquares += metricValue * metricValue; } if (this.restrictToUInt32Values) { bufferData.Max = Math.Round(bufferData.Max); bufferData.Min = Math.Round(bufferData.Min); } return(bufferData); }
protected override object UpdateAggregate_Stage1(MetricValuesBufferBase <double> buffer, int minFlushIndex, int maxFlushIndex) { lock (_updateLock) { for (int index = minFlushIndex; index <= maxFlushIndex; index++) { double metricValue = buffer.GetAndResetValue(index); if (Double.IsNaN(metricValue)) { continue; } _sum += metricValue; _max = (_sum > _max) ? _sum : _max; _min = (_sum < _min) ? _sum : _min; } if (_restrictToUInt32Values) { _sum = Math.Round(_sum); _max = Math.Round(_max); _min = Math.Round(_min); } } return(null); }