Probekit analysis
Probes are reusable Java code fragments that you write to collect detailed runtime data about a program's objects, instance variables, arguments, and exceptions. Probekit provides a framework on the Eclipse platform to help you create and use probes. One common use of Probekit is to create lightweight profilers that collect only the data developers are interested in.
A probekit contains one or more probes, and each probe contains one or more probe fragments. You can specify when probes are executed, and on which programs they execute. The probe fragments are a set of Java methods that are merged with standard boilerplate code with a new Java class generated and compiled. The functions generated from the probe fragments appear as static methods of the generated probe class.
The probekit engine-also called the byte-code instrumentation (BCI) engine-is used to apply probe fragments by inserting the calls into the target programs. The insertion process of the call statements into the target methods is referred to as instrumentation. The data items requested by a probe fragment are passed as arguments (for example, method name and arguments). The benefit of this approach is that the probe can be inserted into a large number of methods with small overhead.
Probe fragments can be executed at the following points:
|
|
| At method entry or exit time
|
|
|
| At exception handler time
|
|
|
| Before the original code in the class static initializer
|
|
|
| Before every executable code when source code is available
|
|
|
| When specific methods are called, not inside the called method
|
Each of the probe fragments can access the following data:
|
|
| Package, class, and method name
|
There are two major types of probes available to the user (Table | -4).
Table 27-4
Type of probe
|
Description
|
Method probe
|
Probe can be inserted anywhere within the body of a method with the class or jar files containing the target methods instrumented by the BCI engine.
|
Callsite probe
|
Probe is inserted into the body of the method that calls the target method. The class or jar files that call the target instrumented by the BCI engine.
|
Types of probes available with Probekit