Troubleshooting
Problem
A user wants to measure how many milliseconds it takes a command or series of commands to execute in an IBM® Rational® Robot GUI script. The user also wants to be access the results during runtime. The results of the Timer command are available during runtime, but it only measures events in seconds. The StartTimer and StopTimer commands measure events in milliseconds, but their results are not available at runtime.
Resolving The Problem
Use the GetTickCount() Microsoft® Windows® API. Call GetTickCount() before and after the event, and then compare the results. For example:
Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
Sub Main
Dim ElaspedTime As Long
Dim StartingTime as Long
Dim EndingTime as Long
StartingTime = GetTickCount()
[statement_block]
EndingTime = GetTickCount()
ElaspedTime = EndingTime - StartingTime
[statement_block evaluating ElapsedTime]
End Sub
A tick is a millisecond, and the function returns the number of ticks passed since Microsoft® Windows® started. The value is reset to 0 after about 49.3 days. You cannot use this function for a period of time greater than 49.3 days.
As you would when you use a Timer (StartTimer & StopTimer) you should clear the Acknowledge results option, and set the Delay between commands value to 0, on the Playback Tab in the Robot Menu > Tools > GUI Playback Options.
Historical Number
14078
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21122458