probe targets and filters [message #123803] |
Fri, 22 February 2008 18:52  |
Eclipse User |
|
|
|
Hi,
I'm trying to do a combination of beforeCall/afterCall/entry/exit probes for
watching when methods are called. I'm having a little bit of a problem with
filters and targets, though.
Here is my problem. I don't want the probe to instrument any classes in
java.lang*, sun*, etc. classes because that can screw up the runtime and prevent
the program from even launching. However, I _do_ want to be notified when
methods like Printstream.println() are being called from within my code. So, I
set the targets of the probes to include nearly everything, and the filters of
the profiling to exclude things like java*, sun*, com.ibm*, etc...
But, when I do this, I'm not getting notified of messages such as
System.out.println(). For example, the simple HelloWorld program:
package mypackage;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
will notify me when main enters and exits, but it won't tell me about the
before/after calls on the PrintStream.println() method. I need, however, to
know when such calls are made. Any clues on how to fix my problem? Thanks.
Del
|
|
|
|
|
Re: probe targets and filters [message #126213 is a reply to message #125669] |
Thu, 13 March 2008 03:22  |
Eclipse User |
|
|
|
Del Myers wrote:
> No, I am using dynamic instrumentation. There are no "filtering" options
> for static instrumentation since you manually choose which classes to
> instrument. Any ideas?
This is not entirely correct. Both static and dynamic Probekit use a
"2-layer" filtering scheme. The first layer is used to determine the set
of classes that will be instrumented (regardless of probe types and
targets). The second layer determines which parts of a class (which
passed the first layer) to actually instrument.
In static Probekit, the first layer corresponds to the list of classes
you manually select for instrumentation. In your case, this can work
because you want to instrument only your application's classes and I
assume that these classes are known upfront (before you actually run
your application). In dynamic Probekit, the first layer corresponds to
the filter set you define in the Monitor tab of the Profiling Launch
Configuration dialog (by double-clicking the "Java Profiling - JRE
1.5..." node). Again, you can easily define a filter-set which includes
your application's classes and excludes everything else.
The second filtering layer is derived from a Probe's "target" definition.
To summarize all of this: it seems that the solution for your problem is
to define Probe targets to include the "java.lang.*" classes and methods
you need, and then use the first layer filter (in either static of
dynamic Probekit) to instruct Probekit to instrument only your
application's classes.
HTH,
Asaf
--
Asaf Yaffe
Eclipse TPTP Committer, JVMTI Profiler
|
|
|
Powered by
FUDForum. Page generated in 0.03549 seconds