public class SimpleLongTaskTimer extends AbstractMeter implements LongTaskTimer
LongTaskTimer.Builder
Meter.Id, Meter.Type
Constructor and Description |
---|
SimpleLongTaskTimer(Meter.Id id,
Clock clock) |
Modifier and Type | Method and Description |
---|---|
int |
activeTasks()
Returns the current number of tasks being executed.
|
double |
duration(long task,
java.util.concurrent.TimeUnit unit)
Returns the current duration for an active task.
|
double |
duration(java.util.concurrent.TimeUnit unit)
Returns the cumulative duration of all current tasks in nanoseconds.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
long |
start()
Start keeping time for a task.
|
long |
stop(long task)
Mark a given task as completed.
|
getId
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
builder, getType, measure, record, record, record, recordCallable
public long start()
LongTaskTimer
start
in interface LongTaskTimer
public long stop(long task)
LongTaskTimer
stop
in interface LongTaskTimer
task
- Id for the task to stop. This should be the value returned from LongTaskTimer.start()
.public double duration(long task, java.util.concurrent.TimeUnit unit)
LongTaskTimer
duration
in interface LongTaskTimer
task
- Id for the task to stop. This should be the value returned from LongTaskTimer.start()
.unit
- The time unit to scale the returned value to.public double duration(java.util.concurrent.TimeUnit unit)
LongTaskTimer
duration
in interface LongTaskTimer
public int activeTasks()
LongTaskTimer
activeTasks
in interface LongTaskTimer
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object