Class Utils.Timer

java.lang.Object
com.illumon.util.Utils.Timer
Enclosing class:
Utils

public static class Utils.Timer
extends Object
Mark a start time, and allow logging of elapsed time and time between log messages (steps of a process).
  • Constructor Summary

    Constructors 
    Constructor Description
    Timer​(com.fishlib.io.logger.Logger log)  
    Timer​(com.fishlib.io.logger.Logger log, com.fishlib.io.log.LogLevel level)  
  • Method Summary

    Modifier and Type Method Description
    void elapsed​(String message)
    log "message: elapsed xx ms"
    void elapsedAndStep​(String message)
    log "message: step time xx ms, elapsed xx ms"
    static com.fishlib.io.log.LogLevel getDefaultLogLevel()
    Get (and possibly initialize) the default log level for Timers, configured by DEFAULT_LOG_LEVEL_PROP
    com.fishlib.io.log.LogLevel getLogLevel()
    return the LogLevel configured for this timer.
    long getStepTime()
    Get the elapsed time for the current step.
    static void setDefaultLogLevel​(com.fishlib.io.log.LogLevel level)
    Set the static default log level for Timers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Timer

      public Timer​(@NotNull com.fishlib.io.logger.Logger log)
    • Timer

      public Timer​(@NotNull com.fishlib.io.logger.Logger log, @NotNull com.fishlib.io.log.LogLevel level)
  • Method Details

    • getDefaultLogLevel

      public static com.fishlib.io.log.LogLevel getDefaultLogLevel()
      Get (and possibly initialize) the default log level for Timers, configured by DEFAULT_LOG_LEVEL_PROP
      Returns:
      the default log level
    • setDefaultLogLevel

      public static void setDefaultLogLevel​(@NotNull com.fishlib.io.log.LogLevel level)
      Set the static default log level for Timers.
      Parameters:
      level - the new default level
    • elapsed

      public void elapsed​(@NotNull String message)
      log "message: elapsed xx ms"
      Parameters:
      message - the message
    • elapsedAndStep

      public void elapsedAndStep​(@NotNull String message)
      log "message: step time xx ms, elapsed xx ms"
      Parameters:
      message - the message
    • getStepTime

      public long getStepTime()
      Get the elapsed time for the current step.
      Returns:
      now - markTime
    • getLogLevel

      public com.fishlib.io.log.LogLevel getLogLevel()
      return the LogLevel configured for this timer.
      Returns:
      the configured LogLevel