Search in sources :

Example 1 with HistogramIterationValue

use of org.HdrHistogram.HistogramIterationValue in project quasar by puniverse.

the class HistogramSnapshot method getValues.

@Override
public long[] getValues() {
    final long[] vals = new long[(int) histogram.getTotalCount()];
    int i = 0;
    for (HistogramIterationValue value : histogram.recordedValues()) {
        long val = value.getValueIteratedTo();
        for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) vals[i++] = val;
    }
    if (i != vals.length)
        throw new IllegalStateException("Total count was " + histogram.getTotalCount() + " but iterating values produced " + vals.length);
    return vals;
}
Also used : HistogramIterationValue(org.HdrHistogram.HistogramIterationValue)

Example 2 with HistogramIterationValue

use of org.HdrHistogram.HistogramIterationValue in project grpc-java by grpc.

the class AsyncClient method merge.

private static Histogram merge(List<Histogram> histograms) {
    Histogram merged = new Histogram(HISTOGRAM_MAX_VALUE, HISTOGRAM_PRECISION);
    for (Histogram histogram : histograms) {
        for (HistogramIterationValue value : histogram.allValues()) {
            long latency = value.getValueIteratedTo();
            long count = value.getCountAtValueIteratedTo();
            merged.recordValueWithCount(latency, count);
        }
    }
    return merged;
}
Also used : Utils.saveHistogram(io.grpc.benchmarks.Utils.saveHistogram) Histogram(org.HdrHistogram.Histogram) HistogramIterationValue(org.HdrHistogram.HistogramIterationValue)

Aggregations

HistogramIterationValue (org.HdrHistogram.HistogramIterationValue)2 Utils.saveHistogram (io.grpc.benchmarks.Utils.saveHistogram)1 Histogram (org.HdrHistogram.Histogram)1