InstructionTimes (Instruction Processing Time)

The InstructionTimes instruction returns the processing time of each instruction in the program.

Syntax

InstructionTimes ( Dest )

Remarks

The InstructionTimes instruction loads the Dest array with processing times for each instruction in the program. The time is reflected in microseconds. InstructionTimes must appear before the BeginProg statement in the program.

Each element in the array corresponds to a line number in the program. To accommodate all of the instructions in the program, the array must be dimensioned to the total number of lines in the program, including blank lines and comments. The Dest array must also be dimensioned as a long integer (for example, Public Array(20) AS LONG).

NOTE: The processing time for an instruction may vary. For instance, it will take longer to execute instructions when the datalogger is communicating with another device. Also, the time it takes for the datalogger to execute each scan of the program depends on whether the program is compiled in PipelineMode or SequentialMode.

NOTE: The InstructionTimes() instruction will not output while a Debug() instruction is in the data logger program. When Debug() is in use, instruction execution times can be viewed in the trace output of Debug().

Troubleshooting Variable Out Of Bounds Error

InstructionTimes can be inserted into a program that is returning a variable out of bounds error to indicate which variable is in error. A variable out of bounds error, along with the line number of the instruction that is causing the problem, will show up in the Compile Results of the datalogger.

A variable out of bounds error can occur at run-time if an instruction attempts to write beyond the size of a dimensioned array (for instance, the instruction tries to write to Array(5), but Array is declared as Array(4)).