Class ProfilerTimerFilter.TimerWorker

  • Enclosing class:
    ProfilerTimerFilter

    private class ProfilerTimerFilter.TimerWorker
    extends java.lang.Object
    Class that will track the time each method takes and be able to provide information for each method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.atomic.AtomicLong callsNumber
      The number of calls
      private java.lang.Object lock
      A lock for synchinized blocks
      private java.util.concurrent.atomic.AtomicLong maximum
      The slowest operation
      private java.util.concurrent.atomic.AtomicLong minimum
      The fastest operation
      private java.util.concurrent.atomic.AtomicLong total
      The sum of all operation durations
    • Constructor Summary

      Constructors 
      Constructor Description
      TimerWorker()
      Creates a new instance of TimerWorker.
    • Field Detail

      • total

        private final java.util.concurrent.atomic.AtomicLong total
        The sum of all operation durations
      • callsNumber

        private final java.util.concurrent.atomic.AtomicLong callsNumber
        The number of calls
      • minimum

        private final java.util.concurrent.atomic.AtomicLong minimum
        The fastest operation
      • maximum

        private final java.util.concurrent.atomic.AtomicLong maximum
        The slowest operation
      • lock

        private final java.lang.Object lock
        A lock for synchinized blocks
    • Constructor Detail

      • TimerWorker

        public TimerWorker()
        Creates a new instance of TimerWorker.
    • Method Detail

      • addNewDuration

        public void addNewDuration​(long duration)
        Add a new operation duration to this class. Total is updated and calls is incremented
        Parameters:
        duration - The new operation duration
      • getAverage

        public double getAverage()
        Gets the average reading for this event
        Returns:
        the average reading for this event
      • getCallsNumber

        public long getCallsNumber()
        Returns:
        The total number of profiled operation
      • getTotal

        public long getTotal()
        Returns:
        the total time
      • getMinimum

        public long getMinimum()
        Returns:
        the lowest execution time
      • getMaximum

        public long getMaximum()
        Returns:
        the longest execution time