Class ConcurrentTimeCounter


  • public class ConcurrentTimeCounter
    extends Object
    A class to accumulate simple stats of some time points. All methods are safe to use from multiple threads.
    • Constructor Detail

      • ConcurrentTimeCounter

        public ConcurrentTimeCounter()
    • Method Detail

      • add

        public void add​(int time)
      • getTimeSumAndCountAndReset

        public long getTimeSumAndCountAndReset()
      • getAndResetMaxTime

        @Nullable
        public Integer getAndResetMaxTime()
        Returns the max time add(int)ed since the previous call to this method or since the creation of this object, or null if no times were added.
      • getAndResetMinTime

        @Nullable
        public Integer getAndResetMinTime()
        Returns the min time add(int)ed since the previous call to this method or since the creation of this object, or null if no times were added.
      • timeSum

        public static int timeSum​(long timeSumAndCount)
      • count

        public static int count​(long timeSumAndCount)