TimerCreate Function

Action

Creates a timer with an optional name.

Syntax

hTimer = TimerCreate (sTimerName)
Variable Description
hTimer A handle to the new timer. HTIMER.
sTimerName The name of the timer, stored in the timer structure referenced by hTimer. STRING

Notes

TimerCreate creates a timer, which you can use like a stop watch to measure elapsed time. 4Test timers are accurate to the millisecond (.001 seconds). The value returned is a handle to the new timer, which you use when calling other timer functions.

The optional sTimerName supplies the timer name. If this parameter is not supplied, the default name is TimerXX, where TimerXX is auto-incremented, starting with Timer0. This parameter is provided for interfacing with Silk Performer; it is not used for Silk Test Classic scripts.

The timer scope is from creation (TimerCreate) to either the script completion or the TimerDestroy function, whichever is first. Duplicate timer names are accepted and the first match will be retrieved on name searches.

Example

STRING sOverallTime
HTIMER TotalTimer
TotalTimer = TimerCreate ("MyTimer")
TimerStart (TotalTimer)
// ...
TimerStop (TotalTimer)
sOverallTime = TimerStr (TotalTimer)
Print ("All code executed in {sOverallTime} seconds")
TimerDestroy (TotalTimer)