IBM Support

How to measure an event in milliseconds and access the results during runtime.

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.



[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Playback","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2001a;2001a.04.00;2002;2002.05.00;2002 Release 2;2002.05.20;2003;2003.06.00;2003.06.12;2003.06.13;2003.06.14","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

14078

Document Information

Modified date:
16 June 2018

UID

swg21122458