An executableUnit probe fragment example

This example demonstrates how to use the executableUnit probe fragment.

In the example, a probe emits a trace line to System.out with the source file name, method names, and line tables for every class that loads, then emits a trace line for every executable unit that executes.

This probe is defined by the following entries in the Probekit editor:

  • Fragment (select Fragment in the tree pane to enter these values):
    • Fragment Type: staticInitializer
    • Data Items:
      • Data Type: className, Name: cname
      • Data Type: classSourceFile, Name: csource
      • Data Type: methodNames, Name: mnames
      • Data Type: methodLineTables, Name: mltables
    • Java Code:

      System.out.println(" [ClassLoad: " + cname +
      " source: " + csource +
      " methods: " + mnames +
      " linetables: " + mltables + "]");

  • Fragment (right-click Probe and click New > Fragment to enter these values):
    • Fragment Type: executableUnit
    • Data Items:
      • Data Type: methodNumber, Name: mnum
      • Data Type: executableUnitNumber, Name: eunum
    • Java Code:

      System.out.println("[hit method " + mnum + " eu " + eunum + "]");