CAPL timer in a log file

967 views Asked by At

How can I set up a timer when playing a log file. The timer should start when the log file starts. At a certain event the timer should be printed out in the write window.

There are som built in functions in CAPL do you know how they work?

For example TimeToElapse

Thanks

1

There are 1 answers

0
Andreas Serov On

First insert a replay block in your measurement configuration. In the replay block select your log file and uncheck "Start replay on measurement start" if you want to start the replay from CAPL code.

In the following example I bound the procedure to two on key events:

on key 'a' {
  replayStart("ReplayBlockName");
  setTimer(mytimer, mytime);
}

on timer mytimer {
// on timer event needed so that setTimer function works properly
}

on key 's' {
  write("time to elapse = %d", timeToElapse(mytimer));
}

So basically hit the key 'a' during measurement and afterwards key 's' to see how much time is left. Keep in mind that the output is dependent on your timer. When declaring a regular timer, timeToElapse returns whole seconds. When declaring a msTimer, timeToElapse returns milli seconds.