Class ConcurrentTimeCounter
- java.lang.Object
-
- org.apache.druid.java.util.emitter.core.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 Summary
Constructors Constructor Description ConcurrentTimeCounter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int time)static intcount(long timeSumAndCount)IntegergetAndResetMaxTime()Returns the max timeadd(int)ed since the previous call to this method or since the creation of this object, or null if no times were added.IntegergetAndResetMinTime()Returns the min timeadd(int)ed since the previous call to this method or since the creation of this object, or null if no times were added.longgetTimeSumAndCountAndReset()static inttimeSum(long timeSumAndCount)
-
-
-
Method Detail
-
add
public void add(int time)
-
getTimeSumAndCountAndReset
public long getTimeSumAndCountAndReset()
-
getAndResetMaxTime
@Nullable public Integer getAndResetMaxTime()
Returns the max timeadd(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 timeadd(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)
-
-