Probekit overview

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:

This is what the probe looks like in the Probekit editor:

Probekit editor showing entries for the basic code sample described in the help topic.

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:
  1. 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.
  2. 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.
  3. 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.
  4. 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:

Probe fragments can access data items that provide various kinds of information about the application at the point where they are inserted. For example:

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.

Related concepts
Working with probes
Method probes versus callsite probes
Related reference
Probekit examples