Skip to content

Trace Scripts

Jaroslav Bachorik edited this page Aug 29, 2014 · 2 revisions

Trace scripts

Trace scripts define what and how should be traced. They are ordinary annotated java classes. The annotations specify where the instrumentation should be placed and what data should be made available to the trace actions.

Script Elements

Probe Point

"location" or "event" at which a set of tracing statements are executed. Probe point is "place" or "event" of interest where we want to execute some tracing statements.

Trace Actions or Actions

Trace statements that are executed whenever a probe "fires".

Action Methods

BTrace trace statements that are executed when a probe fires are defined inside a static method a class. Such methods are called "action" methods.

Restrictions

In order to ensure the safety of the injected code the following restrictions are enforced:

  • no new objects
  • no new arrays
  • no throwing exceptions
  • no catching exceptions
  • no arbitrary instance or static method calls - only the public static methods of available extension classes or methods declared in the same program may be called from a BTrace program
  • no outer, inner, nested or local classes
  • no synchronized blocks or synchronized methods
  • no loops (for, while, do..while)
  • no extending arbitrary class (super class has to be java.lang.Object)
  • no implementing interfaces
  • no assert statements
  • no class literals.