SETTRACE Verb – BBj

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

BBj-Specific Information

Description

BBj traces Java calls by listing:

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

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

 

MODE

Description

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.

PREC=int

Specifies the timer precision (number of decimal places). The default precision is 2 decimal places; the maximum is 6.

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

ClosedVersion History

  • In BBj 8.0 and higher, SETTRACE supports PREC=int shown in Example 3.

  • In BBj 9.0 and higher, SETTRACE supports MODE="FLUSH" to complete all pending client-side operations before proceeding to the next program line.

  • In BBj 20.20 and higher, SETTRACE supports MODE="LEVEL=int" to specify a single call level to be traced.

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