Knowledge Base

  1. Home
  2. Knowledge Base
  3. Technical Support
  4. Script Commands
  5. Timer commands
Timer commands

testRTC offers timing mechanisms, enabling you to time certain activities within your web service.

With these, you can set expectations based on timing, or collect timing related custom metrics.

rtcStartTimer()

testRTC timer functions can be used to measure the time interval between two points (A and B) in the test script. In order to measure the time interval, use function .rtcStartTimer() in location A in the script and function .rtcGetTimer() in location B in the script.

Arguments:

Name Type Description
key string The name of the timer to start

rtcGetTimer()

Returns the time elapsed from timer start time.

Arguments:

Name Type Description
key string The name of the timer to get
callback function Callback function to be called with the time elapsed since the timer started

Code example:

.rtcStartTimer('myTimer')
 
.rtcGetTimer('myTimer', function(timer) {
    client.rtcInfo('Time: %d', timer)
})
 
.rtcSetMetricFromTimer('tmetric', 'myTimer')

Remarks:

Was this article helpful?

Related Articles

Leave a Reply 0 comments

Leave a Reply: