Class TaskStatistics
- java.lang.Object
-
- org.hawaiiframework.async.statistics.TaskStatistics
-
public final class TaskStatistics extends Object
Statistics about a task.It registers, in nano-seconds, the queue time, the execution time and the total time (queue time + execution time).
- Since:
- 2.0.0
- Author:
- Rutger Lubbers
-
-
Constructor Summary
Constructors Constructor Description TaskStatistics()
The constructor, sets the queue start time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enqueue()
Set the timestamp the task is offered for execution.Long
getExecutionTime()
Get the time (in nano seconds) the task was executing.Long
getQueueTime()
Get the time (in nano seconds) the task was in the queue.Long
getTotalTime()
Get the time (in nano seconds) the task took from start (offer / queue) to completion.void
startExecution()
Set the timestamp the task is actually run.void
stopExecution()
Set the timestamp the task is finished running.
-
-
-
Method Detail
-
enqueue
public void enqueue()
Set the timestamp the task is offered for execution.
-
startExecution
public void startExecution()
Set the timestamp the task is actually run.
-
stopExecution
public void stopExecution()
Set the timestamp the task is finished running.
-
getQueueTime
public Long getQueueTime()
Get the time (in nano seconds) the task was in the queue.- Returns:
- the interval the task was queued.
-
getExecutionTime
public Long getExecutionTime()
Get the time (in nano seconds) the task was executing.- Returns:
- the interval the task was running.
-
getTotalTime
public Long getTotalTime()
Get the time (in nano seconds) the task took from start (offer / queue) to completion.This is the same as queue time + execution time.
- Returns:
- the total time the task took to complete.
-
-