Class StopwatchLogger

java.lang.Object
org.apache.jackrabbit.oak.stats.StopwatchLogger
All Implemented Interfaces:
Closeable, AutoCloseable

public class StopwatchLogger extends Object implements Closeable
Utility class to be used for tracking of timing within methods. It makes use of the Clock.Fast for speeding up the operation.
  • Constructor Details

    • StopwatchLogger

      public StopwatchLogger(@NotNull @NotNull String clazz)
      Create a class with the provided class.
      Parameters:
      clazz -
    • StopwatchLogger

      public StopwatchLogger(@NotNull @NotNull Class<?> clazz)
      instantiate a class with the provided class
      Parameters:
      clazz -
    • StopwatchLogger

      public StopwatchLogger(@Nullable @Nullable Logger customLog, @NotNull @NotNull Class<?> clazz)
      Instantiate a class with the provided class and custom logger. The provided logger, if not null, will be then used for tracking down times
      Parameters:
      customLog -
      clazz -
    • StopwatchLogger

      public StopwatchLogger(@Nullable @Nullable Logger customLog, @NotNull @NotNull String clazz)
      Instantiate a class with the provided class and custom logger. The provided logger, if not null, will be then used for tracking down times
      Parameters:
      customLog -
      clazz -
  • Method Details

    • start

      public void start()
      starts the clock
    • split

      public void split(@Nullable @Nullable String message)
      track of an intermediate time without stopping the ticking.
      Parameters:
      message -
    • stop

      public void stop(@Nullable @Nullable String message)
      track the time and stop the clock.
      Parameters:
      message -
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • isStarted

      public boolean isStarted()
      Returns:
      true if the clock has been started. False otherwise.
    • isEnabled

      public boolean isEnabled()
      Returns:
      true whether the provided appender has DEBUG enabled and therefore asked to track times.