use of com.twitter.common.stats.WindowedApproxHistogram in project commons by twitter.
the class MetricsInsertionBench method setUp.
@Override
protected void setUp() {
metrics = Metrics.createDetached();
counter = metrics.createCounter("counter");
h = metrics.createHistogram("histogram");
wh = new WindowedApproxHistogram();
ws = new WindowedStatistics();
}
use of com.twitter.common.stats.WindowedApproxHistogram in project commons by twitter.
the class MetricsQueryBench method setUp.
@Override
protected void setUp() {
metrics = Metrics.createDetached();
FakeClock clock = new FakeClock();
Amount<Long, Time> window = WindowedApproxHistogram.DEFAULT_WINDOW;
int slices = WindowedApproxHistogram.DEFAULT_SLICES;
Amount<Long, Time> delta = Amount.of(window.as(Time.MILLISECONDS) / N, Time.MILLISECONDS);
Amount<Long, Data> maxMem = WindowedApproxHistogram.DEFAULT_MAX_MEMORY;
for (int i = 0; i < 10; i++) {
metrics.createCounter("counter-" + i).increment();
HistogramInterface h = new Histogram("hist-" + i, window, slices, maxMem, null, Histogram.DEFAULT_QUANTILES, clock, metrics);
for (int j = 0; j < N; j++) {
h.add(j);
clock.advance(delta);
}
}
// Initialize Histograms and fill them with values (in every buckets for windowed ones)
hist = new Histogram("hist", window, slices, maxMem, null, Histogram.DEFAULT_QUANTILES, clock);
approxHist = new WindowedApproxHistogram(window, slices, maxMem, clock);
winStats = new WindowedStatistics(window, slices, clock);
for (int j = 0; j < N; j++) {
hist.add(j);
approxHist.add(j);
winStats.accumulate(j);
clock.advance(delta);
}
}
use of com.twitter.common.stats.WindowedApproxHistogram in project commons by twitter.
the class MetricsCreationBench method timeCreatingWindowedHistogram.
/**
* WindowedHistogram is serie of ApproximateHistograms in sliding window.
*/
public void timeCreatingWindowedHistogram(int n) {
WindowedApproxHistogram h;
int i = n;
while (i != 0) {
h = new WindowedApproxHistogram();
h.add(1);
i--;
}
}
Aggregations