Package org.terrier.utility
Class TerrierTimer
- java.lang.Object
-
- java.lang.Thread
-
- org.terrier.utility.TerrierTimer
-
- All Implemented Interfaces:
java.lang.Runnable
public class TerrierTimer extends java.lang.Thread
This class implements a timer.
-
-
Field Summary
Fields Modifier and Type Field Description protected double
done
Number of items in task completedprotected short
lastPercentage
the last percentage that was output.protected java.lang.String
message
the message that should be output with the progressprotected long
startingTime
The starting system time in millisecond.protected double
total
The total number of items to process in a task.
-
Constructor Summary
Constructors Constructor Description TerrierTimer()
TerrierTimer(java.lang.String message, double total)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
elapsed()
Get a string summarising the processing/remaining time in minutes and seconds.void
finished()
short
getPercentage()
java.lang.String
getRemainingTime()
void
increment()
void
increment(double dIncrememt)
static java.lang.String
longToText(long timems)
void
run()
void
setDone(double done)
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
startingTime
protected final long startingTime
The starting system time in millisecond.
-
total
protected final double total
The total number of items to process in a task.
-
done
protected volatile double done
Number of items in task completed
-
lastPercentage
protected short lastPercentage
the last percentage that was output. Set to a negative value, so that a value is always determined
-
message
protected final java.lang.String message
the message that should be output with the progress
-
-
Method Detail
-
setDone
public void setDone(double done)
-
getPercentage
public short getPercentage()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
increment
public void increment()
-
increment
public void increment(double dIncrememt)
-
finished
public void finished()
-
getRemainingTime
public java.lang.String getRemainingTime()
-
elapsed
public java.lang.String elapsed()
Get a string summarising the processing/remaining time in minutes and seconds.
-
longToText
public static java.lang.String longToText(long timems)
-
-