- System requirements
- Profiler architecture
- Running the profiler
- Profiler activation
- Running applications with the profiler
- Connect to profiled application
- Troubleshoot connection problems
- Solving performance problems
- CPU profiling
- Threads
- Deadlock detector
- Memory profiling
- Garbage collection
- Monitor profiling
- Exception profiling
- Probes: monitor events of various kinds
- Events in user interface
- Event inspections
- Built-in probes
- Probe classes
- Monitoring method invocation events
- Probe class annotation @MethodPattern
- Callback onEnter()
- Callback onReturn()
- Callbacks onUncaughtException() and onUncaughtExceptionExt()
- Parameter annotation @Param
- Parameter annotation @Params
- Parameter annotation @This
- Parameter annotation @ClassRef
- Parameter annotation @MethodName
- Parameter annotation @MethodParameterTypes
- Parameter annotation @MethodSignature
- Parameter annotation @OnEnterResult
- Parameter annotation @ReturnValue
- Parameter annotation @ThrownException
- Probe application rules
- Data storage
- Performance Charts
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Summary, snapshot annotation, automatic deobfuscation
- IDE integration
- Time measurement (CPU time, wall time)
- Filters
- Snapshot directory customization
- Export of profiling results to HTML, CSV, XML, plain text
- Profiler Java API
- Profiler HTTP API
- Command line tool to control profiling
- Settings
- FAQ: How to profile in my scenario?
Callback method parameter annotation @ClassRef
Callback parameter annotated with @ClassRef
will be assigned with a reference to the class where the method being executed is defined.
Declaration type
Callback parameter annotated with @ClassRef
should be declared as java.lang.Class
.
In which callbacks can be used
Parameter annotated with @ClassRef
can be used in any callback.
Notes on using @ClassRef vs @This
Use @ClassRef
when applying probe to static methods,
because @This is null
in that case.
When applying probe to non-static methods,
you can either use @ClassRef
or
call getClass()
method of the object passed via @This.
However, please note the difference:
the class returned by getClass()
method will be the actual class of the object whose method is running,
while @ClassRef
will give the class where the method is defined.
The result will be different if the method is defined in a base class
and is not overridden in derived classes.
Example:
package com.foo;
class Base {
void f() {...}
void g() {...}
}
class Derived extends Base {
// f() is overridden, g() is not overridden
void f() {...}
}
...
@MethodPattern("foo.bar.*:*(*)")
public class MyProbe {
public static void onEnter(@This Base _this, @ClassRef Class _class) {
System.out.println(_this.getClass());
System.out.println(_class);
}
}
...
Derived obj = new Derived();
// Applying MyProbe to this call will print:
// class com.foo.Derived
// class com.foo.Derived
obj.f();
// Applying MyProbe to this call will print:
// class com.foo.Derived
// class com.foo.Base
obj.g();