// Token: 0x060004E0 RID: 1248 RVA: 0x0001EA9C File Offset: 0x0001CC9C public Bucket[] CreateBuckets(int bucketsCount, ThresholdMinMaxValue minMax) { if (bucketsCount == 0 || minMax.Max < minMax.Min) { return(new Bucket[0]); } Bucket[] array = new Bucket[bucketsCount]; double num = (minMax.Max - minMax.Min) / (double)bucketsCount; double num2 = ThresholdsHelper.RoundThresholdsValue(minMax.Min); for (int i = 0; i < bucketsCount; i++) { double minValue = num2; num2 = ThresholdsHelper.RoundThresholdsValue(num2 + num); array[i] = new Bucket(minValue, num2); } array[array.Length - 1].MaxValue = minMax.Max; double referalMinValue = ThresholdsHelper.RoundThresholdsValue(minMax.Min); if (array.All((Bucket bucket) => bucket.MinValue.Equals(referalMinValue))) { return(new Bucket[] { array[array.Length - 1] }); } return(array); }
public Bucket[] CreateBuckets(int bucketsCount, ThresholdMinMaxValue minMax) { if (bucketsCount == 0 || minMax.get_Max() < minMax.get_Min()) { return(new Bucket[0]); } Bucket[] bucketArray = new Bucket[bucketsCount]; double num = (minMax.get_Max() - minMax.get_Min()) / (double)bucketsCount; double maxValue = ThresholdsHelper.RoundThresholdsValue(minMax.get_Min()); for (int index = 0; index < bucketsCount; ++index) { double minValue = maxValue; maxValue = ThresholdsHelper.RoundThresholdsValue(maxValue + num); bucketArray[index] = new Bucket(minValue, maxValue); } bucketArray[bucketArray.Length - 1].MaxValue = minMax.get_Max(); double referalMinValue = ThresholdsHelper.RoundThresholdsValue(minMax.get_Min()); if (!((IEnumerable <Bucket>)bucketArray).All <Bucket>((Func <Bucket, bool>)(bucket => bucket.MinValue.Equals(referalMinValue)))) { return(bucketArray); } return(new Bucket[1] { bucketArray[bucketArray.Length - 1] }); }
private static StatisticalDataHistogram[] CreateBucketsAndHistogram( StatisticalData[] data, TimeFrame[] timeFrames, int intervalsCount, ThresholdMinMaxValue minMax) { Bucket[] buckets = new Bucketizer().CreateBuckets(intervalsCount, minMax); StatisticalDataHistogram[] pointsFromBuckets = HistogramCalculator.CreateHistogramsPointsFromBuckets(HistogramCalculator.CreateHistogramForTimeFrames(timeFrames, buckets.Length), buckets); return(HistogramCalculator.CalculatePointsFrequencyFromStatistics(data, pointsFromBuckets)); }
public virtual ThresholdMinMaxValue GetThresholdMinMaxValues( string thresholdName, int instanceId) { if (CoreThresholdDataProvider.IsResponseTime(thresholdName)) { ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue(); thresholdMinMaxValue.set_Min(0.0); thresholdMinMaxValue.set_Max(100000.0); thresholdMinMaxValue.set_DataType(typeof(int)); return(thresholdMinMaxValue); } if (CoreThresholdDataProvider.IsPercentLoss(thresholdName)) { ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue(); thresholdMinMaxValue.set_Min(0.0); thresholdMinMaxValue.set_Max(100.0); thresholdMinMaxValue.set_DataType(typeof(int)); return(thresholdMinMaxValue); } if (CoreThresholdDataProvider.IsCpuLoad(thresholdName)) { ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue(); thresholdMinMaxValue.set_Min(0.0); thresholdMinMaxValue.set_Max(100.0); thresholdMinMaxValue.set_DataType(typeof(int)); return(thresholdMinMaxValue); } if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName)) { ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue(); thresholdMinMaxValue.set_Min(0.0); thresholdMinMaxValue.set_Max(100.0); thresholdMinMaxValue.set_DataType(typeof(double)); return(thresholdMinMaxValue); } if (!CoreThresholdDataProvider.IsPercentDiskUsed(thresholdName)) { throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", (object)thresholdName)); } ThresholdMinMaxValue thresholdMinMaxValue1 = new ThresholdMinMaxValue(); thresholdMinMaxValue1.set_Min(0.0); thresholdMinMaxValue1.set_Max(100.0); thresholdMinMaxValue1.set_DataType(typeof(int)); return(thresholdMinMaxValue1); }
public ThresholdMinMaxValue Calculate(StatisticalData[] values) { if (values.Length == 0) { ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue(); thresholdMinMaxValue.set_Max(0.0); thresholdMinMaxValue.set_Min(0.0); return(thresholdMinMaxValue); } double val1_1 = (double)values[0].Value; double val1_2 = (double)values[0].Value; for (int index = 1; index < values.Length; ++index) { val1_1 = Math.Min(val1_1, (double)values[index].Value); val1_2 = Math.Max(val1_2, (double)values[index].Value); } ThresholdMinMaxValue thresholdMinMaxValue1 = new ThresholdMinMaxValue(); thresholdMinMaxValue1.set_Min(val1_1); thresholdMinMaxValue1.set_Max(val1_2); return(thresholdMinMaxValue1); }