Ejemplo n.º 1
0
  private static void pongHandler(
      final DirectBuffer buffer, final int offset, final int length, final Header header) {
    final long pingTimestamp = buffer.getLong(offset);
    final long rttNs = System.nanoTime() - pingTimestamp;

    HISTOGRAM.recordValue(rttNs);
  }
  private static String createEncodedHistogram() {
    Random random = new Random();

    Histogram histogram = new Histogram(MAXIMUM_LATENCY, LATENCY_PRECISION);
    for (int i = 0; i < 10; i++) {
      histogram.recordValue(random.nextInt((int) MAXIMUM_LATENCY));
    }
    return getEncodedHistogram(histogram);
  }