Package com.codahale.metrics

Examples of com.codahale.metrics.Timer


        return c;
    }

    public static synchronized Timer newTimer(String name)
    {
        Timer t = (Timer) _registered.get(name);
        if (t == null) {
            t = _metrics.timer(name);
            _registered.put(name, t);
        }
        return t;
View Full Code Here


      }
      // timers for scheduler operations
      int timeWindowSize = conf.getInt(
              SLSConfiguration.METRICS_TIMER_WINDOW_SIZE,
              SLSConfiguration.METRICS_TIMER_WINDOW_SIZE_DEFAULT);
      schedulerAllocateTimer = new Timer(
              new SlidingWindowReservoir(timeWindowSize));
      schedulerHandleTimer = new Timer(
              new SlidingWindowReservoir(timeWindowSize));
      schedulerHandleTimerMap = new HashMap<SchedulerEventType, Timer>();
      for (SchedulerEventType e : SchedulerEventType.values()) {
        Timer timer = new Timer(new SlidingWindowReservoir(timeWindowSize));
        schedulerHandleTimerMap.put(e, timer);
      }
      // histogram for scheduler operations (Samplers)
      schedulerHistogramList = new ArrayList<Histogram>();
      histogramTimerMap = new HashMap<Histogram, Timer>();
View Full Code Here

    @Override
    public void run() {
      samplerLock.lock();
      try {
        for (Histogram histogram : schedulerHistogramList) {
          Timer timer = histogramTimerMap.get(histogram);
          histogram.update((int) timer.getSnapshot().getMean());
        }
      } finally {
        samplerLock.unlock();
      }
    }
View Full Code Here

     *
     * @param name - the fully qualified method name
     */
    public MethodMetrics(String name) {
        this.name = name;
        this.timer = new Timer();

        this.rateFactor = TimeUnit.SECONDS.toSeconds(1);
        this.durationFactor = 1.0 / TimeUnit.MILLISECONDS.toNanos(1);
    }
View Full Code Here

    MockClient client = application.client();
    MockViewBridge view = client.render();                                                      //<3>
    assertEquals("ok", view.assertStringResponse());
    assertEquals(Collections.singleton("examples.metrics"), SharedMetricRegistries.names());    //<4>
    MetricRegistry registry = SharedMetricRegistries.getOrCreate("examples.metrics");
    Timer timer = registry.getTimers().get("juzu.responses");                                   //<5>
    assertEquals(1, timer.getCount());
    Meter meter = registry.getMeters().get("custom");                                           //<6>
    assertNotNull(meter);
  }
View Full Code Here

    } else {
      s_logger.debug("Skipping graph execution");
    }
    cycleReference.get().postExecute();
    final long durationNanos = cycleReference.get().getDuration().toNanos();
    final Timer timer = deltaCycle != null ? _deltaCycleTimer : _fullCycleTimer;
    if (timer != null) {
      timer.update(durationNanos, TimeUnit.NANOSECONDS);
    }
    _totalTimeNanos += durationNanos;
    _cycleCount += 1;
    s_logger.info("Last latency was {} ms, Average latency is {} ms",
        durationNanos / NANOS_PER_MILLISECOND,
View Full Code Here

      throw new NotFoundException();
    }

    List<EvaluationResponse> responses = Lists.newArrayList();

    Timer timer = this.metricRegistry.timer(createName(id, method));

    Timer.Context context = timer.time();

    try {
      List<FieldName> groupFields = evaluator.getGroupFields();
      if(groupFields.size() == 1){
        FieldName groupField = groupFields.get(0);
View Full Code Here

        this.statementNameStrategy = statementNameStrategy;
    }

    @Override
    public void collect(long elapsedTime, StatementContext ctx) {
        final Timer timer = getTimer(ctx);
        timer.update(elapsedTime, TimeUnit.NANOSECONDS);
    }
View Full Code Here

                    if (label.endsWith("/@/monitor")) {
                        // not include monitor information on this route itself
                        continue;
                    }

                    Timer timer = timerEntry.getValue();

                    if (i != 0) {
                        resp.getWriter().print(",");
                    }
                    double nsPerMs = 1000000;
                    resp.getWriter().print(String.format(Locale.ENGLISH,
                            "{ \"id\": %s, \"label\": \"%s\", \"hits\": %s, \"avg\": %.2f, \"lastVal\": %.2f, \"min\": %.2f, \"max\": %.2f," +
                                    " \"active\": %.2f, \"avgActive\": %.2f }",
                            i++,
                            label,
                            timer.getCount(),
                            timer.getSnapshot().getMean() / nsPerMs,
                            timer.getSnapshot().getMedian() / nsPerMs,
                            timer.getSnapshot().getMin() / nsPerMs,
                            timer.getSnapshot().getMax() / nsPerMs,
                            timer.getOneMinuteRate(),
                            timer.getMeanRate()
                    ));
                }
                resp.getWriter().print("]");
            }
        };
View Full Code Here

  }

  public static JStormTimer registerTimer(String name) {
    LOG.info("Register Metric " + name);
   
    Timer instance = metrics.timer(name);
    return new JStormTimer(name, instance);
  }
View Full Code Here

TOP

Related Classes of com.codahale.metrics.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.