Package org.moeaframework.util
Class Timing
java.lang.Object
org.moeaframework.util.Timing
Utility for collecting timing information. Use
startTimer(String)
and stopTimer(String)
to
control when each named timer starts and stops. Timers with different names can be interleaved or nested,
but two timers with the same name can not exist simultaneously.-
Method Summary
Modifier and TypeMethodDescriptionstatic TabularData<org.apache.commons.lang3.tuple.Pair<String,
org.apache.commons.math3.stat.descriptive.StatisticalSummary>> Returns the timing data in tabular format.static void
clear()
Clears all timing data.static void
display()
Displays the collected timing data to standard output.static void
display
(PrintStream out) Displays the collecting timing data.static org.apache.commons.math3.stat.descriptive.StatisticalSummary
getStatistics
(String name) Returns the accumulated timing statistics for the timer with the specified name; ornull
if no such timer exists.static void
startTimer
(String name) Starts a timer with the specified name.static void
Stops the timer with the specified name.
-
Method Details
-
startTimer
Starts a timer with the specified name.- Parameters:
name
- the name of the timer to start
-
stopTimer
Stops the timer with the specified name.- Parameters:
name
- the name of the timer to stop
-
getStatistics
public static org.apache.commons.math3.stat.descriptive.StatisticalSummary getStatistics(String name) Returns the accumulated timing statistics for the timer with the specified name; ornull
if no such timer exists.- Parameters:
name
- the name of the timer- Returns:
- the accumulated timing statistics for the timer with the specified name; or
null
if no such timer exists
-
clear
public static void clear()Clears all timing data. -
asTabularData
public static TabularData<org.apache.commons.lang3.tuple.Pair<String,org.apache.commons.math3.stat.descriptive.StatisticalSummary>> asTabularData()Returns the timing data in tabular format.- Returns:
- the tabular data
-
display
public static void display()Displays the collected timing data to standard output. -
display
Displays the collecting timing data.- Parameters:
out
- the stream for writing the timing data
-