Class SimpleTimerImpl

  • All Implemented Interfaces:
    org.eclipse.microprofile.metrics.Counting, org.eclipse.microprofile.metrics.Metric, org.eclipse.microprofile.metrics.SimpleTimer

    @Vetoed
    public class SimpleTimerImpl
    extends Object
    implements org.eclipse.microprofile.metrics.SimpleTimer
    A timer that aggregates timed durations and provides the total as getElapsedTime() and the number of updates as getCount(). Durations are measured in nanoseconds.
    Since:
    5.202
    Author:
    Jan Bernitt
    • Field Detail

      • clock

        protected final Clock clock
    • Constructor Detail

      • SimpleTimerImpl

        public SimpleTimerImpl​(Clock clock)
    • Method Detail

      • update

        public void update​(Duration duration)
        Specified by:
        update in interface org.eclipse.microprofile.metrics.SimpleTimer
      • time

        public <T> T time​(Callable<T> event)
                   throws Exception
        Specified by:
        time in interface org.eclipse.microprofile.metrics.SimpleTimer
        Throws:
        Exception
      • time

        public void time​(Runnable event)
        Specified by:
        time in interface org.eclipse.microprofile.metrics.SimpleTimer
      • time

        public org.eclipse.microprofile.metrics.SimpleTimer.Context time()
        Specified by:
        time in interface org.eclipse.microprofile.metrics.SimpleTimer
      • getElapsedTime

        public Duration getElapsedTime()
        Specified by:
        getElapsedTime in interface org.eclipse.microprofile.metrics.SimpleTimer
      • getCount

        public long getCount()
        Specified by:
        getCount in interface org.eclipse.microprofile.metrics.Counting
        Specified by:
        getCount in interface org.eclipse.microprofile.metrics.SimpleTimer
      • getMaxTimeDuration

        public Duration getMaxTimeDuration()
        Specified by:
        getMaxTimeDuration in interface org.eclipse.microprofile.metrics.SimpleTimer
      • getMinTimeDuration

        public Duration getMinTimeDuration()
        Specified by:
        getMinTimeDuration in interface org.eclipse.microprofile.metrics.SimpleTimer