$VULCAN/src/timer.scm
, $VULCAN/src/flat-timer.scm
and $VULCAN/src/timer-api.scm
, define the class <mtimer>
. The methods associated with a <mtimer>
are:3.3
(start-<timer>) // make a <mtimer> instance (current-time (self <mtimer>)) // elapsed time (in seconds) since the timer // creation or the last time is was reset (finalize (self <mtimer>)) (last-dt (self <mtimer>)) // elapsed time between the two consecutive // call of set and update (update (self <mtimer>)) (set (self <mtimer>)) (reset (self <mtimer>)) // set the timer creation time to the current timeBy calling
(start-<timer>)
a <mtimer>
instance is created. Depending on whether you are using Vulcan or Flat, the timer will time real time or simulated time respectively. In order to time a piece of code, say the function (f), you enclosed that code between calls to set
and update
as suggested below:
(set! mt (start-<timer>)) ... (set mt) (f) (update mt) (format #t ``~a'' (last-dt mt))The result of
(last-dt mt)
is the time (in milliseconds) taken by the execution of (f)
.