|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ofbiz.base.util.UtilTimer
public class 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.
Field Summary | |
---|---|
protected java.lang.String |
lastMessage
|
protected long |
lastMessageTime
|
protected boolean |
log
|
static java.lang.String |
module
|
protected long |
realStartTime
|
protected boolean |
running
|
protected long |
startTime
|
protected static java.util.Map<java.lang.String,UtilTimer> |
staticTimers
|
protected java.lang.String |
timerName
|
Constructor Summary | |
---|---|
UtilTimer()
Default constructor. |
|
UtilTimer(java.lang.String timerName,
boolean start)
|
|
UtilTimer(java.lang.String timerName,
boolean start,
boolean log)
|
Method Summary | |
---|---|
static void |
closeTimer(java.lang.String timerName)
|
static void |
closeTimer(java.lang.String timerName,
java.lang.String message)
|
static void |
closeTimer(java.lang.String timerName,
java.lang.String message,
java.lang.String module)
|
boolean |
getLog()
Gets the value of the log member, denoting whether log output is off or not |
java.lang.String |
getName()
|
static UtilTimer |
getTimer(java.lang.String timerName)
|
static UtilTimer |
getTimer(java.lang.String timerName,
boolean log)
|
boolean |
isRunning()
|
static UtilTimer |
makeTimer()
|
double |
secondsSinceLast()
Returns the number of seconds since the last time timerString was called |
double |
secondsSinceStart()
Returns the number of seconds since the timer started |
void |
setLog(boolean log)
Sets the value of the log member, denoting whether log output is off or not |
void |
startTimer()
|
static void |
timerLog(java.lang.String timerName,
java.lang.String message,
java.lang.String module)
|
java.lang.String |
timerString(int level,
java.lang.String message)
Creates a string with information including the passed message, the time since the last call, and the time since the beginning. |
java.lang.String |
timerString(java.lang.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 beginning |
java.lang.String |
timerString(java.lang.String message,
java.lang.String module)
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 |
long |
timeSinceLast()
Returns the number of milliseconds since the last time timerString was called |
long |
timeSinceStart()
Returns the number of milliseconds since the timer started |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String module
protected static java.util.Map<java.lang.String,UtilTimer> staticTimers
protected java.lang.String timerName
protected java.lang.String lastMessage
protected long realStartTime
protected long startTime
protected long lastMessageTime
protected boolean running
protected boolean log
Constructor Detail |
---|
public UtilTimer()
public UtilTimer(java.lang.String timerName, boolean start)
public UtilTimer(java.lang.String timerName, boolean start, boolean log)
Method Detail |
---|
public static UtilTimer makeTimer()
public void startTimer()
public java.lang.String getName()
public boolean isRunning()
public java.lang.String timerString(java.lang.String message)
message
- A message to put into the timer String
public java.lang.String timerString(java.lang.String message, java.lang.String module)
message
- A message to put into the timer Stringmodule
- The debug/log module/thread to use, can be null for root module
public double secondsSinceStart()
public double secondsSinceLast()
public long timeSinceStart()
public long timeSinceLast()
public void setLog(boolean log)
log
- The new value of logpublic boolean getLog()
public java.lang.String timerString(int level, java.lang.String message)
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
public static UtilTimer getTimer(java.lang.String timerName)
public static UtilTimer getTimer(java.lang.String timerName, boolean log)
public static void timerLog(java.lang.String timerName, java.lang.String message, java.lang.String module)
public static void closeTimer(java.lang.String timerName)
public static void closeTimer(java.lang.String timerName, java.lang.String message)
public static void closeTimer(java.lang.String timerName, java.lang.String message, java.lang.String module)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |