SETTRACE Verb – BBj

For this topic's original documentation, see SETTRACE Verb - Set Line Tracing.

BBj-Specific Information

Description

If STBL("!COMPAT","TRACE_JAVA") is set to TRUE in BBj 22.00 and higher, BBj traces Java calls by listing:

>JAVA: new fully.qualified.classname(arglist)
>JAVA: fully.qualified.methodname(arglist)
>JAVA: fully.qualified.fieldname

In BBj 22.00 and higher, timed SETTRACE output starts with a timestamp line to indicate when the trace was generated and an initial >RUNNING line to indicate the initial program name:

>TIMESTAMP: 2022-03-31 12:34:56
>RUNNING: programname

MODE

Description

BBj Version

FLUSH

Send all pending client-side operations to the client, and wait for the client to report completion, before logging execution time for the line of code and proceeding to the next line.

This significantly slows down overall performance, but can be useful when trying to identify performance issues with client-side code.

9.00

PREC=int

Specifies the timer precision (number of decimal places). The default precision is 4 decimal places in BBj 22.00 and higher (2 decimal places in earlier versions). See Example 3.

8.00
LEVEL=int Specifies the single call level to be traced. The default is to trace all call levels. 20.20

ClosedVersion History

  • In BBj 8.00 and higher, SETTRACE supports PREC=int.

  • In BBj 9.00 and higher, SETTRACE supports MODE="FLUSH".

  • In BBj 20.20 and higher, SETTRACE supports MODE="LEVEL=int".

  • In BBj 22.00 and higher, the default precision was changed from 2 to 4 decimal places.

  • In BBj 22.00 and higher, added timestamp line and initial >RUNNING line for program name.

  • BBj 22.00 introduced the STBL option STBL("!COMPAT","TRACE_JAVA").

Examples

Example 1

0001 SETTRACE
0010 REM ' create an ArrayList object
0020 LET day!=new java.util.ArrayList()
0030 REM ' store the names of the days of the week
0040 FOR d=1 TO 7
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
0060 NEXT d
0070 REM ' and print the local name for Sunday
0080 PRINT day!.get(0)
>run
0010 REM ' create an ArrayList object
0020 LET day!=new java.util.ArrayList()
>JAVA: new java.util.ArrayList()
0030 REM ' store the names of the days of the week
0040 FOR d=1 TO 7
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Sunday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Monday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Tuesday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Wednesday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Thursday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Friday") returns boolean
0060 NEXT d
0050 day!.add(DATE(JUL(2001,7,d):"%Dl"))
>JAVA: java.util.ArrayList.add((java.lang.Object)"Saturday") returns boolean
0060 NEXT d
0070 REM ' and print the local name for Sunday
0080 PRINT day!.get(0)
>JAVA: java.util.ArrayList.get((int)0) returns java.lang.Object
Sunday
***** END

READY
>

Example 2

BBj emits ">JAVA:" trace output even for console-mode commands:

>SETTRACE
>REM ' this call returns a Java double value as a number
>PI=java.lang.Math.PI
>JAVA: java.lang.Math.PI returns double

>REM ' this call creates a java.lang.Integer object
>I!=new java.lang.Integer(23)
>JAVA: new java.lang.Integer((int)23)

>REM ' this call returns a Java boolean value as a number
>TRUE=java.lang.Boolean.TRUE.booleanValue()
>JAVA: java.lang.Boolean.TRUE returns java.lang.Boolean
>JAVA: java.lang.Boolean.booleanValue() returns boolean

Example 3

Increased timer precision:

0010 SETTRACE (0,MODE="timed,prec=3")
0020 FOR X=1 TO 3
0030 PRINT X
0040 NEXT X
>run
0020 FOR X=1 TO 3
   {2.97}{2.949}
0030 PRINT X
   1
{22.61}{19.64}
0040 NEXT X
   {25.175}{2.565}
0030 PRINT X
   2
   {26.95}{1.775}
0040 NEXT X
   {28.698}{1.749}
0030 PRINT X
   3
   {31.043}{2.345}
0040 NEXT X
   {32.737}{1.694}
***** END 

See Also

Verbs - Alphabetical Listing

ENDTRACE Verb