Package org.apache.ofbiz.base.util
Class UtilTimer
java.lang.Object
org.apache.ofbiz.base.util.UtilTimer
Timer handling utility
Utility class for simple reporting of the progress of a process.
Steps are labelled, and the time between each label (or message)
and the time since the start are reported in each call to timerString.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeTimer
(String timerName) static void
closeTimer
(String timerName, String message) static void
closeTimer
(String timerName, String message, String className) boolean
getLog()
Gets the value of the log member, denoting whether log output is off or notgetName()
Gets name.boolean
Is running boolean.static UtilTimer
void
setLog
(boolean log) Sets the value of the log member, denoting whether log output is off or notstatic void
timerString
(int level, String message) Creates a string with information including the passed message, the time since the last call, and the time since the beginning.timerString
(String message) Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginningtimerString
(String message, String className) Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginninglong
Returns the number of milliseconds since the last time timerString was called
-
Constructor Details
-
UtilTimer
public UtilTimer()Default constructor. Starts the timer. -
UtilTimer
-
UtilTimer
-
-
Method Details
-
makeTimer
-
getName
Gets name.- Returns:
- the name
-
isRunning
public boolean isRunning()Is running boolean.- Returns:
- the boolean
-
timerString
Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning- Parameters:
message
- A message to put into the timer String- Returns:
- A String with the timing information, the timer String
-
timerString
Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning- Parameters:
message
- A message to put into the timer StringclassName
- The debug/log className/thread to use, can be null for root className- Returns:
- A String with the timing information, the timer String
-
timeSinceLast
public long timeSinceLast()Returns the number of milliseconds since the last time timerString was called- Returns:
- The number of milliseconds since the last time timerString was called
-
setLog
public void setLog(boolean log) Sets the value of the log member, denoting whether log output is off or not- Parameters:
log
- The new value of log
-
getLog
public boolean getLog()Gets the value of the log member, denoting whether log output is off or not- Returns:
- The value of log
-
timerString
Creates a string with information including the passed message, the time since the last call, and the time since the beginning. This version allows an integer level to be specified to improve readability of the output.- Parameters:
level
- Integer specifying how many levels to indent the timer string so the output can be more easily read through nested method calls.message
- A message to put into the timer String- Returns:
- A String with the timing information, the timer String
-
timerLog
-
closeTimer
-
closeTimer
-
closeTimer
-