Interface ITimeTracker

All Superinterfaces:
Serializable
All Known Implementing Classes:
NullTracker, TimeTracker

public interface ITimeTracker extends Serializable
Utility interface to monitor processing times.
Since:
5.0
Author:
Jon van Leuven
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    end(String name)
    Ends a sub time tracker.
    void
    Ends all open time trackers.
    long
    Gets the time in milliseconds when the tracker is ended.
    Returns the name.
    long
    Gets the time in milliseconds when the tracker is started.
    long
    Gets the total processing time of the time tracker in milliseconds.
    Returns the type.
    void
    Iterates all direct sub time trackers.
    void
    log()
    Logs the time tracker result to a default logger.
    void
    log(Logger log)
    Logs the time tracker result to a custom logger.
    void
    start(String name)
    Start a new sub time tracker.
    void
    start(String name, String type)
    Start a new sub time tracker.
    This methods returns an XML representation of the time tracker.
  • Method Details

    • start

      void start(String name, String type)
      Start a new sub time tracker.
      Parameters:
      name - name of the tracker, cannot be null
      type - type of tracker
    • start

      void start(String name)
      Start a new sub time tracker.
      Parameters:
      name - name of the tracker, cannot be null
    • end

      long end(String name)
      Ends a sub time tracker. Recursively processes all sub time trackers and closes the deepest found tracker.
      Parameters:
      name - name of the tracker, cannot be null
      Returns:
      the time in milliseconds when the tracker is ended.
      Throws:
      IllegalStateException - exception is raised when there is no sub tracker to close or the track contains children that needs to be closed first.
    • endAll

      void endAll()
      Ends all open time trackers.
    • getTotalMillis

      long getTotalMillis()
      Gets the total processing time of the time tracker in milliseconds.
      Returns:
      the total processing time of the time tracker in milliseconds.
    • getStartMillis

      long getStartMillis()
      Gets the time in milliseconds when the tracker is started.
      Returns:
      the time in milliseconds when the tracker is started.
    • getEndMillis

      long getEndMillis()
      Gets the time in milliseconds when the tracker is ended.
      Returns:
      the time in milliseconds when the tracker is ended.
    • log

      void log()
      Logs the time tracker result to a default logger.
      Throws:
      IllegalStateException - an exception is raised when there are non-ended sub trackers
    • log

      void log(Logger log)
      Logs the time tracker result to a custom logger.
      Parameters:
      log - The logger that should be used to write the result to.
      Throws:
      IllegalStateException - an exception is raised when there are non-ended sub trackers
    • toXml

      IXmlElement toXml()
      This methods returns an XML representation of the time tracker.
      Returns:
      an XML representation of the time tracker.
      Throws:
      IllegalStateException - an exception is raised when there are non-ended sub trackers
    • iterateChilds

      void iterateChilds(IChildVisitor visitor)
      Iterates all direct sub time trackers.
      Parameters:
      visitor - to process children
    • getType

      String getType()
      Returns the type.
      Returns:
      the type of the time tracker.
    • getName

      String getName()
      Returns the name.
      Returns:
      The name of the time tracker.