Package org.opentrafficsim.core.gtu
Class Profile
java.lang.Object
org.opentrafficsim.core.gtu.Profile
public final class Profile
extends java.lang.Object
Utility class to profile code efficiency.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 27 jan. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Method Summary
Modifier and Type Method Description static void
end()
Ends timing on the calling class and method, specified by line number (of the start command).static void
end(java.lang.String name)
Ends timing on the calling class and method, specified by given name.static void
print()
Prints profiling output to the console once every 1s or longer, or according to the time set insetPrintInterval()
.static void
setPrintInterval(long printInterval)
Sets a print interval.static void
start()
Starts timing on the calling class and method, specified by line number.static void
start(java.lang.String name)
Starts timing on the calling class and method, specified by given name.static java.lang.String
statistics()
Returns a formatted string of a table with statistics.
-
Method Details
-
start
public static void start()Starts timing on the calling class and method, specified by line number. -
start
public static void start(java.lang.String name)Starts timing on the calling class and method, specified by given name.- Parameters:
name
- String; name
-
end
public static void end()Ends timing on the calling class and method, specified by line number (of the start command). -
end
public static void end(java.lang.String name)Ends timing on the calling class and method, specified by given name.- Parameters:
name
- String; name
-
statistics
public static java.lang.String statistics()Returns a formatted string of a table with statistics.- Returns:
- String formatted string of a table with statistics
-
print
public static void print()Prints profiling output to the console once every 1s or longer, or according to the time set insetPrintInterval()
. This method needs to be called repeatedly, and will only print again after the print interval. If execution time between two call to this method is longer than the print interval, this method prints directly. -
setPrintInterval
public static void setPrintInterval(long printInterval)Sets a print interval.- Parameters:
printInterval
- long; print interval in ms
-