Description | Example | Return Message | Group

StopWatch

Start or reset a counter to time commands

Syntax

StopWatch <ApplicationPath> {Start | Reset}

Related Commands

Description

The StopWatch command allows you to time commands or scripts containing commands to determine how long a command or set of commands takes to complete.

This command is used in conjunction with the StopWatchGet command, which returns the data for split timing or allows you to stop the counter.

Example

To start the counter for all subsequent commands until a StopWatchGet Stop command is sent:

StopWatch / Start

ReturnMessage

If activated, Connect returns an acknowledgement message.

StopWatch and StopWatchGet in a Real-World Situation

Example

Hint: The commands are typically paired as follows: StopWatch / Reset with StopWatchGet / Split or StopWatch / Start with StopWatchGet / Stop

To time an entire event as well as the elapsed time for a particular portion of an event using the StopWatch / Reset with StopWatchGet / Split combination:

StopWatch / Reset

StopWatchGet / Split

ReturnMessage

The StopWatch / Reset and StopWatchGet / Split combination would return the following:
2.5097, 2.5097

Times are returned in seconds (the default) and both times will be the same because the elapsed time since the beginning of the event is the same as the elapsed time for the first portion of the event.

Example

To receive the time that has elapsed between the Split commands and the total time elapsed since Reset based on the previous example:

StopWatchGet / Split HMS

ReturnMessage

Sending the second Split command would return the following:
00:00:03.0296, 00:00:05.5393

This StopWatchGet / Split command returns two times--the time since the last StopWatchGet / Split command and the time since the last StopWatch / Reset command.

You can continue to mimic a real stop watch by sending the StopWatchGet / Split command whenever you wish to return the total elapsed time for the event as well as the elapsed time for a particular portion of an event.

Warning: The StopWatchGet / Split command can only be issued after a StopWatch / Reset or another Split command. Connect will NACK if these rules aren't followed.

Example

To return only the total elapsed time spent calculating accesses using the StopWatch / Start with StopWatchGet / Stop combination:

StopWatch / Start

<USER ACTION: Calculate Accesses>

StopWatchGet / Stop HMS

ReturnMessage

Connect will return the total elapsed time spent calculating accesses as illustrated in the following sample:
00:00:02.5378

Example

To reset the Start/Stop sequence to 0 and time another user-defined action:

StopWatch / Reset

You would then send:

StopWatch / Start

<USER ACTION: Add, delete objects>

StopWatchGet / Stop HMS

ReturnMessage

Connect will return the total elapsed time spent performing that particular action as illustrated in the following sample:
00:00:07.1173

Warning: The StopWatchGet / Stop command can only be issued after a StopWatch / Start command. The StopWatch / Start command can only be issued after a StopWatchGet / Stop or StopWatch / Reset command. Connect will NACK if these rules aren't followed.

Group Membership

This command belongs to the following group(s):

Application Options

Version

4.0.5

STK Programming Interface 11.0.1