Java Code Examples for org.HdrHistogram.Histogram#setAutoResize()
The following examples show how to use
org.HdrHistogram.Histogram#setAutoResize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LazyHistogram.java From glowroot with Apache License 2.0 | 5 votes |
@EnsuresNonNull("histogram") private void convertValuesToHistogram() { // tracking nanoseconds, but only at microsecond precision (to save histogram space) histogram = new Histogram(1000, 2000, HISTOGRAM_SIGNIFICANT_DIGITS); histogram.setAutoResize(true); for (int i = 0; i < size; i++) { histogram.recordValue(values[i]); } values = new long[0]; }
Example 2
Source File: Util.java From maestro-java with Apache License 2.0 | 4 votes |
public static Histogram getAccumulated(final File histogramFile) throws FileNotFoundException { Histogram accumulatedHistogram = null; DoubleHistogram accumulatedDoubleHistogram = null; HistogramLogReader histogramLogReader = new HistogramLogReader(histogramFile); int i = 0; while (histogramLogReader.hasNext()) { EncodableHistogram eh = histogramLogReader.nextIntervalHistogram(); if (eh == null) { logger.error("The histogram library returned an unexpected null value"); break; } if (i == 0) { if (eh instanceof DoubleHistogram) { accumulatedDoubleHistogram = ((DoubleHistogram) eh).copy(); accumulatedDoubleHistogram.reset(); accumulatedDoubleHistogram.setAutoResize(true); } else { accumulatedHistogram = ((Histogram) eh).copy(); accumulatedHistogram.reset(); accumulatedHistogram.setAutoResize(true); } } logger.debug("Processing histogram from point in time {} to {}", Instant.ofEpochMilli(eh.getStartTimeStamp()), Instant.ofEpochMilli(eh.getEndTimeStamp())); if (eh instanceof DoubleHistogram) { Objects.requireNonNull(accumulatedDoubleHistogram).add((DoubleHistogram) eh); } else { Objects.requireNonNull(accumulatedHistogram).add((Histogram) eh); } i++; } if (accumulatedHistogram == null) { throw new EmptyDataSet("The HDR data file did not contain any histogram data"); } return accumulatedHistogram; }