Monitor that tracks execution time in milliseconds.
Note due to the fact that when start is called it resets the startTime instance
variable and different threads can call start() before one of the threads calls
stop this object when used BY ITSELF would not be thread safe. However, when
not reused i.e. when TimeMon's are always taken from MonitorFactory it is threadsafe.
I didn't attempt to make this thread safe as even if it was having two threads
subsequently call start, start before a stop would reset the startTime and so
make one of the callers time off.
Note this class is a thin wrapper that adds time capabilities to the basic Monitor
class
|