public RuntimeStatisticsAggregator() { throughputTotal = 0; responseDataThroughputTotal = 0; numRequestsTotal = 0; numHitsTotal = 0; numL1CacheHitsTotal = 0; numL2CacheHitsTotal = 0; getRequestsPopulationStatistics = new DoublePopulationStatisticsAggregator(); cacheStatisticsTotal = new CacheStatistics(0, 0, 0, 0); }
/** * @param name * @param statsComputationWindow Number of timers to aggregate before computing and * logging statistics. 0 means no timer aggregation. */ public HankTimerEventAggregator(String name, int statsComputationWindow) { this.name = name; this.statsComputationWindow = statsComputationWindow; this.isActive = statsComputationWindow != 0; this.populationStatistics = null; this.previousPopulationStatistics = new DoublePopulationStatisticsAggregator(); this.durations = new double[statsComputationWindow]; clear(); }
populationStatistics = new DoublePopulationStatisticsAggregator();
randomSample[i] = Double.parseDouble(tokens[14 + i]); DoublePopulationStatisticsAggregator getRequestsPopulationStatistics = new DoublePopulationStatisticsAggregator( Double.parseDouble(tokens[10]), Double.parseDouble(tokens[11]),
public static DoublePopulationStatisticsAggregator combine(Collection<DoublePopulationStatisticsAggregator> aggregators) { Random random = new Random(); DoublePopulationStatisticsAggregator result = new DoublePopulationStatisticsAggregator(); for (DoublePopulationStatisticsAggregator aggregator : aggregators) { if (aggregator.maximum > result.maximum) { result.maximum = aggregator.maximum; } if (aggregator.minimum < result.minimum) { result.minimum = aggregator.minimum; } result.numValues += aggregator.numValues; result.total += aggregator.total; } // Now we can create a stream of values based on a // random sample of the aggregators reservoirs but // with the number of values in their streams a weight // and reservoir sample that. This assumes that all given reservoirs // have the same size. for (DoublePopulationStatisticsAggregator aggregator : aggregators) { double ratio = (double) aggregator.numValues / (double) result.numValues; for (double value : aggregator.reservoirSample.getReservoir()) { if ((Math.abs(random.nextDouble()) / Double.MAX_VALUE) < ratio) { result.reservoirSample.sample(value, random); } } } return result; }