HsacExamples.SlimTests.UtilityFixtures.TimerFixture


Timer fixture is intended to be used as library[?].

All times reported are in milliseconds, resume can only be done after pause. After stopping a timer it is no longer available.

We can start and use a timer without a name.

script timer fixture
start timer
wait 5 milliseconds
check time on timer 5>= 5
$elapsed<-[5] time on timer
wait 1 milliseconds
check stop timer 6>$elapsed->[5]

We can start and use a timer with a name.

script timer fixture
start timer test
wait 1 seconds
check time on timer test 1000>= 1000
$elapsed<-[1000] time on timer test
check stop timer test 1000>=$elapsed->[1000]
start timer test2

We can use a timer with a name started in another script table.

script timer fixture
wait 1 milliseconds
check time on timer test2 2> 0
$elapsed<-[2] time on timer test2
check stop timer test2 2>=$elapsed->[2]

We pause and resume timers
script timer fixture
start timer to Pause
wait 1 milliseconds
check pause timer to Pause 1>=1
$paused<-[1] time on timer to Pause
wait 1 milliseconds
check time on timer to Pause $paused->[1]
resume timer to Pause
wait 1 milliseconds
check time on timer to Pause 2>$paused->[1]


We can get information on all timers.

script timer fixture
start timer
start timer test 8
start timer test 9
show all timer times
to Pause 4
default 0
test 8 0
test 9 0
show stop all timers
to Pause 5
default 0
test 8 0
test 9 0

We can get the current system time, possibly specifying a format (the format is the format string used by Java's SimpleDateFormat, also used by '!today') to use.
The difference between these methods and !today is that the latter is evaluated when the test is started, these methods return the time at the moment the test executes them.

script timer fixture
show current system time 08:31:52.151
show current system time as HH:MM:ss.SSS 08:03:52.151
show current system time as E dd-MMM-yy HH:mm:ss.SSS Mon 16-Mar-20 08:31:52.151
show current system time as E dd-MMM-yy HH:mm:ss.SSS in ja-JP-x-lvariant-JP 月 16-3-02 08:31:52.152