Java Profiler 10 Help
Probes: extendable profiling and monitoring
Probe classes
Probe registrationTo apply probe, it should be compiled and registered.
There are 3 ways to register probes:
- On startup via startup options
- In runtime via UI
- In runtime via API
Probe registration on startup
Registration on startup allows to apply probes without altering the profiled application source code. This is especially important for applications such as J2EE servers, and/or production versions of the software.
Also, registration on startup is the simplest way to apply probes.
Use the following startup options:
-
probe=<full qualified class name>- specify probe class(es) to be registered on startup. If the specified class itself is a probe class, it will be registered. If its inner classes are probe classes, they will be registered too. -
builtinprobes=all- register all built-in probes on startup (default behavior) -
builtinprobes=none- register none of the built-in probes on startup -
probeclasspath=<classpath>- add list of jar files and/or directories to system class path to search probe classes in. There is no need to specify the path for built-in probes. -
probebootclasspath=<classpath>- add list of jar files and/or directories to boot class path to probe classes in. There is no need to specify the path for built-in probes. -
probewarningsaserrors- enable strict probe validation: if there are warnings on registration of probes specified with the help ofprobe=<full qualified class name>startup option, they will be treated as errors and the registration will fail.
Probe registration via UI
Connect to profiled application and use "Manage Probes". Read more...
Probe registration via API
With the help of API you can register probes programmatically in runtime.
To register the probe, invoke static method registerProbes()
of class com.yourkit.probes.Probes (see: API):
// register probe classes
public static void registerProbes(Class... probeClasses);
// register probe classes by class name
public static void registerProbes(String... probeClassNames);
When probes are registered by name using
registerProbes(String...),
the probe classes will be searched in paths specified with the help
of startup options
probeclasspath=<classpath> and
probebootclasspath=<classpath> (see above).
There is no need to specify the paths for built-in probes.
Using registerProbes(Class...)
you already supply loaded probe classes,
thus no search in paths is performed.
Example:
import com.yourkit.probes.*;
// ...
Probes.registerProbes(MyProbe.class);
Probes.registerProbes("com.foo.Probe1", "com.foo.Probe2");