Support & information center

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

NameTypeDescription
keystringThe name of the timer to start

rtcGetTimer()

Returns the time elapsed from timer start time.

Arguments

NameTypeDescription
keystringThe name of the timer to get
callbackfunctionCallback function to be called with the time elapsed since the timer started

Code example

client
    .rtcStartTimer('myTimer')

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

    .rtcSetMetricFromTimer('tmetric', 'myTimer');Code language: JavaScript (javascript)

Remarks:

Was this article helpful?

Related Articles