public class StopWatch
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
StopWatch.SimpleStopWatch
This implementation do nothing (it is introduced because performance reason).
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
CREATE_STOPWATCH
Determines whether to use a simple stop watch which do nothing (for performance reasons).
|
private static UESLogger |
logger
Logger instance.
|
private static StopWatch |
SIMPLE_STOPWATCH
StopWatch instance which contains no business logic.
|
private long |
start
Start time.
|
private long |
totalDuration
Total measured time.
|
Modifier | Constructor and Description |
---|---|
private |
StopWatch()
Creates a new instance of StopWatch.
|
Modifier and Type | Method and Description |
---|---|
void |
nextStart()
Starts a new time measuring.
|
static long |
now()
Returns current time.
|
void |
setStartTime(long time)
Time setter.
|
static StopWatch |
start()
Creates an instance of this class and sets the start time.
|
long |
stop()
Returns time difference between invocation
StopWatch.stop() and StopWatch.start() method. |
void |
stop(java.lang.String businessLogicName)
Determines current time, calculates the difference between calling this method and
StopWatch.start() method and the result will be written to the log (at info level). |
void |
stop(UESLogger customLogger,
Determines current time, calculates the difference between calling this method and
StopWatch.start() method and the result will be written to the log (at info level). |
StopWatch.stop()
and StopWatch.start()
method.Determines current time, calculates the difference between calling this method and
StopWatch.start()
method and the result will be written to the log (at info level).
Logged message: Time spent in {0} is {1} ns. [Total measured time: {2} ns.]
businessLogicName
- Identifies measured business logic in the log file.Determines current time, calculates the difference between calling this method and
StopWatch.start()
method and the result will be written to the log (at info level).
Logged message: Time spent in {0} is {1} ns. [Total measured time: {2} ns.]
customLogger
- Logger used for tracing message.businessLogicName
- Identifies measured business logic in the log file.time
- Time.