SETTRACE Verb - Set Line Tracing

Syntax

SETTRACE {(channelno{,MODE=str}}{,ERR=lineref})}

Description

For BBj-specific information, see SETTRACE Verb - BBj. For information about the Performance Analyzer, see _prof Utility - Performance Analyzer.

The SETTRACE verb lists the exact sequence in which program statements execute and is useful when debugging a program that appears to be branching in an unforeseen or undesirable manner.

SETTRACE begins line tracing during program execution. The trace begins with the next line following the SETTRACE. Each time a line is entered during program execution, PRO/5 lists it on the given channel according to the LIST statement rules. ENDTRACE, START, STOP, and END turn off the trace.

If the program jumps to the middle of a compound statement because of a RETURN, NEXT, or RETRY, PRO/5 does not retrace the line. PRO/5 traces the CALLS and EXITS to and from public programs by listing:

>ENTERING: program name
>EXITING: program name

PRO/5 traces RUNs that chain from one program to another by listing:

>RUNNING: program name

The ERR= option in the SETTRACE statement applies only to the SETTRACE statement and not to any errors that occur during the trace.

In PRO/5 4.00 and higher, the SETTRACE verb supports timestamping to aid in profiling BBx programs.

The following two modes have been added to the SETTRACE verb in PRO/5 4.00 and higher:

MODE

Description

TIMED

Causes the trace log to always include time stamps, even if it is being written to the console.

UNTIMED

Suppresses the time stamps for trace logs that are being written to a file.

When a valid mode is not specified, the default behavior is to include time stamps in a log file but suppress timestamps when logging to the console.

The resolution of the timing information may vary by operating system and hardware, with a typical resolution of 10 ms or better.

When enabled, the timing information is displayed in the following manner:

[Line #] <code>

 {A} {B}

A = Total elapsed time since beginning execution of SETTRACE (in milliseconds).

B = Time elapsed since beginning execution of previous line (in milliseconds).

Example

0100 SETTRACE (1,ERR=9500)

Sample Program

0010 SETTRACE (0,MODE="TIMED")
0020 FOR I=1 TO 3
0030 WAIT 1
0040 NEXT I
0050 END


READY
>run
0020 FOR I=1 TO 3
    {1.42}{1.42}
0030 WAIT 1
    {950.46}{949.03}
0040 NEXT I
    {953.61}{3.15}
0030 WAIT 1
    {1951.12}{997.50
0040 NEXT I
    {1954.31}{3.18}
0030 WAIT 1
    {2952.56}{998.25}
0040 NEXT I
    {2955.69}{3.12}
0050 END

See Also

Verbs - Alphabetical Listing

SETTRACE Verb - BBj

ENDTRACE Verb