Class TestRunnerPerformanceLogger
java.lang.Object
de.gebit.integrity.runner.logging.TestRunnerPerformanceLogger
This performance logging service is used to execute several performance-critical segments of test execution. It
allows to print out start/end markers for the performance-relevant sections as well as their (total) duration.
By default, this data is NOT logged. You can enable logging by specifying the system property
By default, this data is NOT logged. You can enable logging by specifying the system property
PERFORMANCE_LOG_ENABLE_PROPERTY with value "true".- Author:
- Rene Schneider - initial API and implementation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA runnable with no result that can throw an exception.static interfaceA runnable with a result.static interfaceA runnable with a result that can throw an exception. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe performance log category used for fork related actions.static final StringThe performance log category used for (script) loading/init-related actions.static final StringThe performance log category used for remoting-related actions.static final StringThe performance log category used for generic test runner related actions.static final StringThe system property to specify to enable performance logging. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E extends Exception>
voidexecuteAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithException<E> aRunnable) Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.<R> RexecuteAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithResult<R> aRunnable) Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.<R,E extends Exception>
RexecuteAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithResultAndException<R, E> aRunnable) Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.voidexecuteAndLog(String aCategoryName, String anActionName, Runnable aRunnable) Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.protected voidLogs something.protected voidlogActionEnd(String aCategoryName, String anActionName, long aStartTime) Logs the end of an action.protected longlogActionStart(String aCategoryName, String anActionName) Logs the start of an action.
-
Field Details
-
PERFORMANCE_LOG_CATEGORY_RUNNER
The performance log category used for generic test runner related actions.- See Also:
-
PERFORMANCE_LOG_CATEGORY_FORK
The performance log category used for fork related actions.- See Also:
-
PERFORMANCE_LOG_CATEGORY_REMOTING
The performance log category used for remoting-related actions.- See Also:
-
PERFORMANCE_LOG_CATEGORY_INIT
The performance log category used for (script) loading/init-related actions.- See Also:
-
PERFORMANCE_LOG_ENABLE_PROPERTY
The system property to specify to enable performance logging.- See Also:
-
-
Constructor Details
-
TestRunnerPerformanceLogger
public TestRunnerPerformanceLogger()
-
-
Method Details
-
executeAndLog
Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.- Parameters:
aCategoryName- the category nameanActionName- the action nameaRunnable- the runnable to execute
-
executeAndLog
public <R> R executeAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithResult<R> aRunnable) Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.- Parameters:
aCategoryName- the category nameanActionName- the action nameaRunnable- the runnable to execute
-
executeAndLog
public <E extends Exception> void executeAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithException<E> aRunnable) throws E Executes the provided runnable and logs the time required to execute it, if performance logging is enabled.- Parameters:
aCategoryName- the category nameanActionName- the action nameaRunnable- the runnable to execute- Throws:
E
-
executeAndLog
public <R,E extends Exception> R executeAndLog(String aCategoryName, String anActionName, TestRunnerPerformanceLogger.RunnableWithResultAndException<R, E> aRunnable) throws EExecutes the provided runnable and logs the time required to execute it, if performance logging is enabled.- Parameters:
aCategoryName- the category nameanActionName- the action nameaRunnable- the runnable to execute- Throws:
E
-
logActionStart
Logs the start of an action.- Parameters:
aCategoryName- the category nameanActionName- the action name
-
logActionEnd
Logs the end of an action.- Parameters:
aCategoryName- the category nameanActionName- the action name
-
log
Logs something.- Parameters:
aLine- the textual line to be logged
-