Package de.galan.commons.util
Class Measure
java.lang.Object
de.galan.commons.util.Measure
Measures invocation of Runnables/Callables in milliseconds. Average of n-invocations can also be calculated (using
the '.every(n)' builder method). A total can be logged using finish() on the Measure object. Thread-safe.
-
Method Summary
Modifier and TypeMethodDescription<V> VMeasure the invocation time of the given Callable.If provided, the average on a single invocation will be calculated/logged after every n-iterations.finish()This method can be called to print the total amount of time taken until that point in time.logStartMessage(boolean logStartMessage) static MeasureBuilds a new Measure object to measure invocations of runnables/callables.run(ExceptionalRunnable runnable) Measure the invocation time of the given ExceptionalRunnable.Measure the invocation time of the given Runnable (without Exception).
-
Method Details
-
measure
Builds a new Measure object to measure invocations of runnables/callables. -
every
If provided, the average on a single invocation will be calculated/logged after every n-iterations. -
logStartMessage
-
finish
This method can be called to print the total amount of time taken until that point in time. -
runnable
Measure the invocation time of the given Runnable (without Exception). -
run
Measure the invocation time of the given ExceptionalRunnable.- Throws:
Exception
-
call
Measure the invocation time of the given Callable.- Throws:
Exception
-