Exemplo n.º 1
0
  @Test
  public void testCounter() {
    System.out.println("******************************* COUNTER *******************************");
    counter = registry.counter("counter");
    try {
      for (int i = 0; i < ITER_COUNT; i++) {
        counter.inc(i);
        Thread.sleep(SLEEP_MS);
      }

    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
  }
Exemplo n.º 2
0
  @Test
  public void testMeter() {
    System.out.println("******************************* METER *******************************");
    meter = registry.meter("meter");
    try {
      for (int i = 0; i < ITER_COUNT; i++) {
        meter.mark();
        Thread.sleep(SLEEP_MS);
      }

    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
  }
Exemplo n.º 3
0
  @Test
  public void testHistogram() {
    System.out.println("******************************* HISTOGRAM *******************************");
    histogram = registry.histogram("histogram");
    try {
      for (int i = 0; i < ITER_COUNT; i++) {
        histogram.update(i);
        Thread.sleep(SLEEP_MS);
      }

    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
  }
Exemplo n.º 4
0
  @Test
  public void testTimer() {
    System.out.println("******************************* TIMER *******************************");
    timer = registry.timer("timer");
    try {
      for (int i = 0; i < ITER_COUNT; i++) {
        final Timer.Context context = timer.time();
        Thread.sleep(SLEEP_MS);
        context.stop();
      }

    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
  }
Exemplo n.º 5
0
  @Test
  public void testGauge() {
    System.out.println("******************************* GAUGE *******************************");
    gauge =
        new Gauge<Integer>() {
          @Override
          public Integer getValue() {
            return count++;
          }
        };
    registry.register("gauge", gauge);
    try {
      for (int i = 0; i < ITER_COUNT; i++) {
        gauge.getValue();
        Thread.sleep(SLEEP_MS);
      }

    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
  }