Class 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 Detail

      • TaskStatistics

        public TaskStatistics()
        The constructor, sets the queue start time.
    • 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.