public class GrobidTimer
extends java.lang.Object
GrobidTimer timer= new GrobidTimer();
timer.start();
timer.stop("Time1");
timer.stop("Time2");
System.out.println("The elapsed time between start and Time1 is "+timer.getElapsedTimeFromStart("Time1"));
System.out.println("The elapsed time between Time1 and Time2 is "+timer.getElapsedTime("Time1","Time2"));
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
START
The tag under which the start time is saved.
|
static java.lang.String |
STOP
The tag end.
|
Constructor and Description |
---|
GrobidTimer()
Constructor.
|
GrobidTimer(boolean pStartNow)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatTime(java.lang.Long pTime)
Format a time from Long to String using the following format:
MIN_SEC_MILI . |
java.util.Map<java.lang.String,java.lang.Long> |
getAllSavedTimes()
Return the complete Map of all stored times.
|
java.lang.Long |
getElapsedTime(java.lang.String pTagStart,
java.lang.String pTagStop)
Compute the time elapsed between pTagStart and pTagStop.
|
java.lang.String |
getElapsedTimeFormated(java.lang.String pTagStart,
java.lang.String pTagStop)
Compute the time elapsed between pTagStart and pTagStop.
|
java.lang.Long |
getElapsedTimeFromStart(java.lang.String pTag)
Compute the time elapsed between the start of the timer and the stop
time.
|
java.lang.String |
getElapsedTimeFromStartFormated(java.lang.String pTag)
Compute the time elapsed between the start of the timer and the stop
time.
Return the time formatted: MIN_SEC_MILI . |
java.lang.Long |
getTime(java.lang.String pTag)
Get all the time saved in the timer.
|
java.lang.String |
getTimeFormated(java.lang.String pTag)
Get all the time saved in the timer.
|
void |
pauseTimer()
Stop time count.
|
void |
restartTimer()
Restart the timer when it has been paused by
pauseTimer() . |
void |
start()
Start the timer.
|
void |
stop(java.lang.String pTag)
Store the current time with the name pTag.
|
public static final java.lang.String START
public static final java.lang.String STOP
public GrobidTimer()
public GrobidTimer(boolean pStartNow)
pStartNow
- if true the timer will be started from now, else the start
method will have to be called.public void start()
public void stop(java.lang.String pTag)
pTag
- the name under which the current time will be saved.public java.lang.Long getElapsedTimeFromStart(java.lang.String pTag)
pTag
- the tag of the stop time.public java.lang.Long getElapsedTime(java.lang.String pTagStart, java.lang.String pTagStop)
pTagStart
- the tag of the start time.pTagStop
- the tag of the stop time.public java.lang.Long getTime(java.lang.String pTag)
START
.public java.lang.String getElapsedTimeFromStartFormated(java.lang.String pTag)
MIN_SEC_MILI
.pTag
- the tag of the stop time.public java.lang.String getElapsedTimeFormated(java.lang.String pTagStart, java.lang.String pTagStop)
MIN_SEC_MILI
.pTagStart
- the tag of the start time.pTagStop
- the tag of the stop time.public java.lang.String getTimeFormated(java.lang.String pTag)
START
. MIN_SEC_MILI
.public void pauseTimer()
restartTimer()
.public void restartTimer()
pauseTimer()
.public java.util.Map<java.lang.String,java.lang.Long> getAllSavedTimes()
public static java.lang.String formatTime(java.lang.Long pTime)
MIN_SEC_MILI
.pTime
- the time to format.