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 void
add(int time)
static int
count(long timeSumAndCount)
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.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.long
getTimeSumAndCountAndReset()
static int
timeSum(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)
-
-