Beispiel #1
0
 public bool TryComputePercentile(KeyValuePair <string, DatapointBox> pair, out int percentileValue)
 {
     return(PercentileCalculator.TryCompute(
                pair.Value.ToArray().ToList(),
                Percentile,
                out percentileValue));
 }
        public IActionResult GetMetricsByPercentileFromCluster(
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime,
            [FromRoute] Percentile percentile)
        {
            var metrics = _repository.GetByPeriodWithSorting(fromTime, toTime, "value");

            var percentileMetric = metrics.Cast <RamMetricModel>().SingleOrDefault(i => i.Value == PercentileCalculator.Calculate(GetListValuesFromMetrics(metrics), (double)percentile / 100.0));

            var response = new AllRamMetricsResponse()
            {
                Metrics = new List <RamMetricManagerDto>()
            };

            response.Metrics.Add(_mapper.Map <RamMetricManagerDto>(percentileMetric));

            _logger.LogInformation($"Запрос персентиля = {percentile} метрик Ram за период с {fromTime} по {toTime} для кластера");

            return(Ok(response));
        }
Beispiel #3
0
    //Writes the data to temporary storage
    public void Write(BinaryWriter w)
    {
        PercentileCalculator pc = new PercentileCalculator();

        w.Write((Double)pc.GetPercentileCalculator(AccumilatedData, PercentileNth));
    }