Interface FunctionTimer

All Superinterfaces:
Meter
All Known Implementing Classes:
CumulativeFunctionTimer, DropwizardFunctionTimer, NoopFunctionTimer, StepFunctionTimer

public interface FunctionTimer extends Meter
A timer that tracks two monotonically increasing functions: one representing the count of events and one representing the total time spent in every event.
  • Method Details

    • builder

      static <T> FunctionTimer.Builder<T> builder(String name, T obj, ToLongFunction<T> countFunction, ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnit)
    • count

      double count()
      Returns:
      The total number of occurrences of the timed event.
    • totalTime

      double totalTime(TimeUnit unit)
      The total time of all occurrences of the timed event.
      Parameters:
      unit - The base unit of time to scale the total to.
      Returns:
      The total time of all occurrences of the timed event.
    • mean

      default double mean(TimeUnit unit)
      Parameters:
      unit - The base unit of time to scale the mean to.
      Returns:
      The distribution average for all recorded events.
    • baseTimeUnit

      TimeUnit baseTimeUnit()
      Returns:
      The base time unit of the timer to which all published metrics will be scaled
    • measure

      default Iterable<Measurement> measure()
      Description copied from interface: Meter
      Get a set of measurements. Should always return the same number of measurements and in the same order, regardless of the level of activity or the lack thereof.
      Specified by:
      measure in interface Meter
      Returns:
      The set of measurements that represents the instantaneous value of this meter.