|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.naftulin.timespan.TimeSpan
Reports the time passed between starting and finishing an action.
Could be extended later to gather statiscics for starting/stopping
events with the same name.
Usage:
TimeSpan readEvent = new TimeSpan("reading values from db for xyz"); readEvent.start(); .. call to db .. readEvent.stop(); readEvent.log(logger, LogLevelAdaptor.DEBUG);
Constructor Summary | |
TimeSpan(java.lang.String name)
Creates times span class with a particular name for the task |
Method Summary | |
void |
log(LogAdapter log,
LogLevelAdaptor level)
Prints a message: 'It took < timedif > miliseconds to finish the task < name >' to log |
void |
start()
Records start time. |
void |
stop()
Records stop time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TimeSpan(java.lang.String name)
name
- name of the taskMethod Detail |
public void start()
public void stop()
public void log(LogAdapter log, LogLevelAdaptor level)
log
- logger to print the message tolevel
- log level
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |