Esempio n. 1
0
  public static double stop() {
    StopwatchData data = dataTL.get();

    if (!data.started) {
      LogFactory.getLog(Stopwatch.class).error("Stopwatch.stop() called but it was not started.");
    }

    double duration = (((double) System.nanoTime()) - ((double) data.startedAt)) / 1e6;
    data.started = false;
    return duration;
  }
Esempio n. 2
0
  public static void start() {
    StopwatchData data = dataTL.get();

    if (data.started) {
      LogFactory.getLog(Stopwatch.class)
          .error("Stopwatch.start() called but it was already started.");
    }

    data.startedAt = System.nanoTime();
    data.started = true;
  }