The intent behind custom timer was to support timers with different
resolutions. Specifically for timing how long it took to analyze CAS, how
long serialization took, etc
By default a Java timer is used that offers 10ms resolution on Windows and
1ms resolution on Linux.

A custom timer is plugged-in in BaseCPMimpl.init() method. It instantiates
TimerFactory which takes a timer class as an arg.
The TimerFactory than creates an instance of the given class and keeps a
reference in a static global variable. From that point
other classes can fetch the instance of the Timer by  calling:

UimaTimer uimaTimer = TimerFactory.getTimer();

UimaTimer has an API to fetch time of different resolution:

  public long getTimeInSecs();
  public long getTimeInMillis();
  public long getTimeInMicros();
  public int getResolution();

Having said all that, I see that the CPM code only uses   public long
getTimeInMillis(), which suggests that this whole thing
is half-baked. There is a way to plug in a custom timer, there is a way to
instantiate it, there is a way to fetch time in different
resolution, what is NOT there is the way to select the timer based on
desired resolution. Perhaps you can address that. Current
work around is to add custom code to getTimeInMills() no matter what
resolution it implements and consider the name of the method
as a misnomer.

Regards, Jerry Cwiklik

Reply via email to