Package org.apache.jackrabbit.oak.stats
Class StopwatchLogger
java.lang.Object
org.apache.jackrabbit.oak.stats.StopwatchLogger
- All Implemented Interfaces:
Closeable,AutoCloseable
Utility class to be used for tracking of timing within methods. It makes use of the
Clock.Fast for speeding up the operation.-
Constructor Summary
ConstructorsConstructorDescriptionStopwatchLogger(@NotNull Class<?> clazz) instantiate a class with the provided classStopwatchLogger(@NotNull String clazz) Create a class with the provided class.StopwatchLogger(@Nullable Logger customLog, @NotNull Class<?> clazz) Instantiate a class with the provided class and custom logger.StopwatchLogger(@Nullable Logger customLog, @NotNull String clazz) Instantiate a class with the provided class and custom logger. -
Method Summary
-
Constructor Details
-
StopwatchLogger
Create a class with the provided class.- Parameters:
clazz-
-
StopwatchLogger
instantiate a class with the provided class- Parameters:
clazz-
-
StopwatchLogger
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
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
track of an intermediate time without stopping the ticking.- Parameters:
message-
-
stop
track the time and stop the clock.- Parameters:
message-
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- 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.
-