Package org.slf4j.profiler
Class StopWatch
java.lang.Object
org.slf4j.profiler.StopWatch
- All Implemented Interfaces:
TimeInstrument
A very basic
TimeInstrument
which can be started and stopped
once and only once.- Author:
- Ceki Gülcü
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal long
Time elapsed between start and stop, in nanoseconds.getName()
All time instruments are named entities.org.slf4j.profiler.TimeInstrumentStatus
void
log()
If the time instrument has an associated logger, then log information about this time instrument.void
print()
Print information about this time instrument on the console.void
Start this time instrument.stop()
Stop this time instrument.stop
(long stopTime) toString()
-
Constructor Details
-
StopWatch
-
-
Method Details
-
start
Description copied from interface:TimeInstrument
Start this time instrument.- Specified by:
start
in interfaceTimeInstrument
- Parameters:
name
- the name of this instrument
-
getName
Description copied from interface:TimeInstrument
All time instruments are named entities.- Specified by:
getName
in interfaceTimeInstrument
- Returns:
- the name of this instrument
-
stop
Description copied from interface:TimeInstrument
Stop this time instrument.- Specified by:
stop
in interfaceTimeInstrument
- Returns:
- this
-
stop
-
toString
-
elapsedTime
Description copied from interface:TimeInstrument
Time elapsed between start and stop, in nanoseconds.- Specified by:
elapsedTime
in interfaceTimeInstrument
- Returns:
- time elapsed in nanoseconds
-
getStatus
- Specified by:
getStatus
in interfaceTimeInstrument
-
print
Description copied from interface:TimeInstrument
Print information about this time instrument on the console.- Specified by:
print
in interfaceTimeInstrument
-
log
Description copied from interface:TimeInstrument
If the time instrument has an associated logger, then log information about this time instrument. Note thatStopWatch
instances cannot log whileProfiler
instances can.- Specified by:
log
in interfaceTimeInstrument
-