Package org.HdrHistogram

Examples of org.HdrHistogram.AbstractHistogram


      errors++;
   }

   @Override
   public <T> T getRepresentation(Class<T> clazz, Object... args) {
      AbstractHistogram histogram = getHistogram();
      if (clazz == DefaultOutcome.class) {
         return (T) new DefaultOutcome(histogram.getTotalCount(), errors, histogram.getMean(), histogram.getMaxValue());
      } else if (clazz == MeanAndDev.class) {
         return (T) new MeanAndDev(histogram.getMean(), histogram.getStdDeviation());
      } else if (clazz == Throughput.class) {
         return (T) Throughput.compute(histogram.getTotalCount(), histogram.getMean(), args);
      } else if (clazz == Percentile.class) {
         double percentile = Percentile.getPercentile(args);
         return (T) new Percentile(histogram.getValueAtPercentile(percentile));
      } else if (clazz == Histogram.class) {
         int buckets = Histogram.getBuckets(args);
         double percentile = Histogram.getPercentile(args);
         AbstractHistogram.AllValues values = histogram.allValues();
         ArrayList<Long> ranges = new ArrayList<>();
         ArrayList<Long> counts = new ArrayList<>();
         long min = Math.max(histogram.getMinValue(), 1);
         long max = Math.max(histogram.getValueAtPercentile(percentile), 1);
         if (max < min) max = Math.max(histogram.getMaxValue(), min + 1);
         double exponent = Math.pow((double) max / (double) min, 1d / buckets);
         double current = min * exponent;
         long accCount = 0, lastCount = 0;
         for (HistogramIterationValue value : values) {
            accCount += value.getCountAddedInThisIterationStep();
View Full Code Here


            ranges.add(value.getValueIteratedTo());
            counts.add(value.getCountAddedInThisIterationStep());
         }
      }
      compacted = new Histogram(Projections.toLongArray(ranges), Projections.toLongArray(counts));
      AbstractHistogram temp = histogram;
      histogram = null;
      AbstractHistogram revived = getHistogram();
      if (temp.getTotalCount() != revived.getTotalCount()) throw new IllegalStateException(temp.getTotalCount() + " vs. " + revived.getTotalCount());
      if (!temp.equals(revived)) {
         throw new IllegalStateException("different");
      }
   }
View Full Code Here

   protected AbstractHistogram getHistogram() {
      if (histogram != null) {
         return histogram;
      }
      AbstractHistogram hist = new org.HdrHistogram.Histogram(maxValue, digits);
      for (int i = 0; i < compacted.ranges.length; ++i) {
         hist.recordValueWithCount(compacted.ranges[i], compacted.counts[i]);
      }
      return hist;
   }
View Full Code Here

TOP

Related Classes of org.HdrHistogram.AbstractHistogram

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.