java.lang.Object
com.aquima.interactions.foundation.timetracker.TimeTracker
All Implemented Interfaces:
ITimeTracker, Serializable

public class TimeTracker extends Object implements ITimeTracker
Utility class to monitor processing times.
Since:
5.0
Author:
Jon van Leuven
See Also:
  • Constructor Details

    • TimeTracker

      public TimeTracker()
      Default constructor that creates a time tracker with the name 'root'.
    • TimeTracker

      public TimeTracker(String name)
      Constructs a time tracker with the specified name.
      Parameters:
      name - The name of the time tracker
    • TimeTracker

      public TimeTracker(String name, String type)
      Constructs a time tracker with the specified name and type.
      Parameters:
      name - The name of the time tracker
      type - The type of the time tracker
    • TimeTracker

      public TimeTracker(String name, String type, TimeTracker parent)
      Constructs a time tracker with the specified name, type and parent.
      Parameters:
      name - The name of the time tracker
      type - The type of the time tracker
      parent - The parent time tracker.
  • Method Details

    • start

      public void start(String name)
      Description copied from interface: ITimeTracker
      Start a new sub time tracker.
      Specified by:
      start in interface ITimeTracker
      Parameters:
      name - name of the tracker, cannot be null
    • start

      public void start(String name, String type)
      Description copied from interface: ITimeTracker
      Start a new sub time tracker.
      Specified by:
      start in interface ITimeTracker
      Parameters:
      name - name of the tracker, cannot be null
      type - type of tracker
    • end

      public long end(String name)
      Description copied from interface: ITimeTracker
      Ends a sub time tracker. Recursively processes all sub time trackers and closes the deepest found tracker.
      Specified by:
      end in interface ITimeTracker
      Parameters:
      name - name of the tracker, cannot be null
      Returns:
      the time in milliseconds when the tracker is ended.
    • endAll

      public void endAll()
      Description copied from interface: ITimeTracker
      Ends all open time trackers.
      Specified by:
      endAll in interface ITimeTracker
    • getTotalMillis

      public long getTotalMillis()
      Description copied from interface: ITimeTracker
      Gets the total processing time of the time tracker in milliseconds.
      Specified by:
      getTotalMillis in interface ITimeTracker
      Returns:
      the total processing time of the time tracker in milliseconds.
    • getStartMillis

      public long getStartMillis()
      Description copied from interface: ITimeTracker
      Gets the time in milliseconds when the tracker is started.
      Specified by:
      getStartMillis in interface ITimeTracker
      Returns:
      the time in milliseconds when the tracker is started.
    • getEndMillis

      public long getEndMillis()
      Description copied from interface: ITimeTracker
      Gets the time in milliseconds when the tracker is ended.
      Specified by:
      getEndMillis in interface ITimeTracker
      Returns:
      the time in milliseconds when the tracker is ended.
    • getType

      public String getType()
      Description copied from interface: ITimeTracker
      Returns the type.
      Specified by:
      getType in interface ITimeTracker
      Returns:
      the type of the time tracker.
    • getName

      public String getName()
      Description copied from interface: ITimeTracker
      Returns the name.
      Specified by:
      getName in interface ITimeTracker
      Returns:
      The name of the time tracker.
    • iterateChilds

      public void iterateChilds(IChildVisitor visitor)
      Description copied from interface: ITimeTracker
      Iterates all direct sub time trackers.
      Specified by:
      iterateChilds in interface ITimeTracker
      Parameters:
      visitor - to process children
    • log

      public void log(Logger log)
      Description copied from interface: ITimeTracker
      Logs the time tracker result to a custom logger.
      Specified by:
      log in interface ITimeTracker
      Parameters:
      log - The logger that should be used to write the result to.
    • log

      public void log()
      Description copied from interface: ITimeTracker
      Logs the time tracker result to a default logger.
      Specified by:
      log in interface ITimeTracker
    • toXml

      public IXmlElement toXml()
      Description copied from interface: ITimeTracker
      This methods returns an XML representation of the time tracker.
      Specified by:
      toXml in interface ITimeTracker
      Returns:
      an XML representation of the time tracker.