Package org.moeaframework.util
Class Timing
java.lang.Object
org.moeaframework.util.Timing
Global timer for quickly measuring and displaying timing data.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TabularData<Timer>
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.protected static Timer
getOrCreate
(String name) Gets or creates the timer with the given name.static org.apache.commons.math3.stat.descriptive.StatisticalSummary
getStatistics
(String name) Returns the accumulated timing statistics for the timer with the specified name.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. If no timing data has been collected, returns an empty statistics object.- Parameters:
name
- the name of the timer- Returns:
- the accumulated timing statistics
-
clear
public static void clear()Clears all timing data. -
getOrCreate
Gets or creates the timer with the given name.- Parameters:
name
- the name of the timer- Returns:
- the timer
-
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
-