Class Timekeeper

  • All Implemented Interfaces:
    Stopwatch
    Direct Known Subclasses:
    Stopwatch.DefaultTimekeeper

    public abstract class Timekeeper
    extends StopwatchBlocks
    Default implementation of a Stopwatch. Subclasses need to extend this to transport the stopwatches across async boundaries and get notified when a stopwatch is stopped.
    • Constructor Detail

      • Timekeeper

        public Timekeeper​(boolean recordActiveTime,
                          boolean isEnabled)
    • Method Detail

      • recordActiveTime

        public boolean recordActiveTime()
      • isEnabled

        public boolean isEnabled()
      • add

        public void add​(java.lang.String name)
        Specified by:
        add in class StopwatchBlocks
      • add

        public void add​(java.lang.String name,
                        long startTime)
      • add

        public void add​(java.lang.String name,
                        long startTime,
                        long sampling)
      • add

        public void add​(java.lang.String name,
                        long startTime,
                        boolean recordActiveTime)
      • add

        public void add​(java.lang.String name,
                        long startTime,
                        long sampling,
                        boolean recordActiveTime)
      • addEmpty

        public void addEmpty​(java.lang.String name)
      • isActive

        public boolean isActive​(java.lang.String name)
      • startTime

        public long startTime​(java.lang.String name,
                              boolean remove)
      • stop

        public void stop​(java.lang.String name)
        Description copied from interface: Stopwatch
        Stop an active stopwatch with the specified name creating a user defined time interval. A user defined stopwatch may start and stop in any location in the asynchronous flow, i.e. it may span over several actors, futures, or streams.

        Parameters:
        name - name of the stopwatch to stop
      • stop

        public void stop​(java.lang.String name,
                         long stopTime)
      • suspendStopwatches

        public Timekeeper.Stopwatches suspendStopwatches()
        INTERNAL API

        Suspend the active stopwatches to transport them across an async boundary.

        Returns:
        (undocumented)
      • suspendStopwatches

        public Timekeeper.Stopwatches suspendStopwatches​(long suspendTime)
        INTERNAL API

        Suspend the active stopwatches to transport them across an async boundary.

        Parameters:
        suspendTime - (undocumented)
        Returns:
        (undocumented)
      • resumeStopwatches

        public void resumeStopwatches​(Timekeeper.Stopwatches suspended)
        INTERNAL API

        Resume suspended stopwatches after an async boundary jump.

        Parameters:
        suspended - (undocumented)
      • resumeStopwatches

        public void resumeStopwatches​(Timekeeper.Stopwatches suspended,
                                      long resumeTime)
        INTERNAL API

        Resume suspended stopwatches after an async boundary jump.

        Parameters:
        suspended - (undocumented)
        resumeTime - (undocumented)
      • resumeEmptyStopwatches

        public void resumeEmptyStopwatches()
        INTERNAL API

        Resume empty stopwatches after an async boundary jump.

      • stopped

        protected void stopped​(java.lang.String name,
                               Timekeeper.StopwatchTimer stopwatch,
                               long stopTime)
        INTERNAL API

        A stopwatch stopped.

        Parameters:
        name - (undocumented)
        stopwatch - (undocumented)
        stopTime - (undocumented)
      • stopped

        protected abstract void stopped​(java.lang.String name,
                                        long elapsed,
                                        long active)
        INTERNAL API

        A stopwatch stopped.

        Parameters:
        name - the name of the stopwatch
        elapsed - the recorded time for this stopwatch in nanoseconds
        active - the recorded active time for this stopwatch in nanoseconds