Copyright (C) 1994, Digital Equipment Corp.File: ETimer.i3
This interface provides a set of non-overlapping timers. The timers record elapsed time, not CPU time.
A background timer and a garbage collection timer are automatically provided.
The stack of suspended timers can contain at most 100 timers.
INTERFACEETimer ; IMPORT Wr; TYPE T <: REFANY; PROCEDURE New (lab: TEXT): T;
Create and return a new timer with label lab. PROCEDURE Relabel (t: T; lab: TEXT);
Assignlabtot's label.
PROCEDURE Push (t: T);
Suspend the currently running timer, start t. PROCEDURE Pop ();
Suspend the currently running timer, resume the previous one.
PROCEDURE Dump (wr: Wr.T);
Dump the non-zero timers to wr. Note, the timers will be dumped
in the reverse order of how they were created. PROCEDURE Elapsed (t: T): LONGREAL;
Returns the seconds accumulated by t. PROCEDURE TotalElapsed (): LONGREAL;
Returns the total elpased seconds
PROCEDURE Next (prev: T): T;
Returns the timer followingprevin the global list of all timers. IfprevisNIL, the first timer is returned. Ifprevis the last known timer,NILis returned.
PROCEDURE Enable ();
Start the timers. Note that Enable must be called at
least once before any timers will begin accumulating time. PROCEDURE Reset (t: T);
Reset t's accumulator to zero. PROCEDURE ResetAll ();
Reset all timers to zero.
END ETimer.