Interface DurationCounter

All Known Implementing Classes:
SimpleMillisCounter

public interface DurationCounter
The DurationCounter interface represents a mechanism for measuring time durations between a "start" point and an "stop" point.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Retrieves the elapsed time duration between the "start" and "end" points, and then resets the internal state of the counter for subsequent measurements.
    void
    Starts the time measurement.
    void
    Ends the time measurement.
  • Method Details

    • start

      void start()
      Starts the time measurement. This method should be called when you want to begin measuring the duration.
    • stop

      void stop()
      Ends the time measurement. This method should be called when you want to stop measuring the duration.
    • getAndReset

      long getAndReset()
      Retrieves the elapsed time duration between the "start" and "end" points, and then resets the internal state of the counter for subsequent measurements.
      Returns:
      The elapsed time duration in millis (possibly 0). -1 if called when counter has started but not stopped.