Probekit is a framework on the Eclipse platform that you can use
to write and use probes. Probes are Java™ code fragments that can be inserted
into a program to provide information about the program as it runs.
To understand probes, start with the sample probe described here. It is
a basic probe that prints a message identifying every method that is called
when your program runs.
Probes are defined by entries that you make in the Probekit editor. This
sample contains a single fragment;
fragments determine what the probe
does. Fragment definitions include:
- A specification of the fragment type. This fragment is an entry fragment,
which means that it runs at method entry time.
- Data items that the fragment can access. Here, the data items allow
the fragment to access class and method names.
- The Java code snippet that defines the probe's logic.
This fragment calls System.out.println to display the class and method
name of methods that run.
This is what the probe looks like in the Probekit editor:

After you have created a probe using the Probekit editor, you can apply
it to the class and jar files for your project. Then, when you run the project,
the fragment code will run along with your program.
Here is an overview of how you create and use probes, including information
about how Probekit helps you:
- You use the Probekit editor to create probes in Probekit source files.
Probekit source files must have the extension .probe. They can contain
one or more probes, and each probe can contain one or more probe fragments.
- Probekit assembles the probe fragments into a set of Java methods,
and then compiles them. When Probekit compiles a probe, it combines the probe
fragments with standard Java boilerplate, and generates Java source
code for a new probe class. The functions generated from the probe fragments
appear as static methods of the new probe class.
- When you apply a probe, you specify target class and jar files that you
want to investigate. The Probekit byte-code instrumentation (BCI) engine refers
to the list of available probes and their target patterns and inserts calls
to probe fragment methods into the target programs. The process of inserting
call statements into target methods is referred to as instrumentation.
A class that contains an instrumented method is called a probed class.
The data items requested by a probe fragment (for example, the method name
and class name) are passed as arguments.
- After your application has been instrumented. The
probe fragments will run when the program runs.
The probe fragment
type determines when a fragment runs. You can
specify types that cause the fragment to run on the following occasions:
- At method entry time.
- At method exit time (either a normal return or as the result of an exception).
- At exception handler time; that is, at the top of a catch clause,
or the top of a finally clause that is called as the result of an
exception.
- Before the original code in the class static initializer.
- Before every executable unit of code (when source code information is
available).
- When specific methods are called. (In this case, instrumentation is done
at the call site, not inside the called method.)
Probe fragments can access data items that provide various kinds of information
about the application at the point where they are inserted. For example:
- Package, class, and method name
- Method signature
- this object
- Arguments
- Return value
If you want your probe applied only to certain classes and methods, specify
targets or set up filters. For more information, see Probe targets and filters.