- System requirements
- Profiler architecture
- Running the profiler
- Profiler activation
- Start profiling
- IDE integration
- Java server integration wizard
- Attach profiler to a running application
- Remote profiling
- Enabling profiling manually
- Startup options
- Connect to profiled application
- Profiling troubleshooting
- Profiling overhead: how to reduce or avoid
- Solving performance problems
- CPU profiling
- Deadlock detector
- Memory profiling
- Garbage collection
- Monitor profiling
- Exception profiling
- Probes: monitor events of various kinds
- Performance Charts
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Summary, snapshot annotation, automatic deobfuscation
- Time measurement (CPU time, wall time)
- 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
- FAQ: How to profile in my scenario?
Attach profiler to a running application
Attach technique allows to load the profiler agent into running JVM. Attaching the profiler agent simplifies profiling, as it avoids a special step to enable profiling: any running Java application can be profiled on demand. Unfortunately, the attach mode is not an ultimate solution, because attaching to a running JVM is not always possible, and some profiling features are not available.
The attach mode limitations
Existing JVMs provide only limited set of profiling capabilities for the attached agents. To get all profiling capabilities, you still have to start the profiled application with the profiler agent instead.
The attach mode is only supported for Oracle JDK, OpenJDK HotSpot, and IBM JDK based on OpenJ9.
Older IBM VMs, i.e. those not based on the OpenJ9 JVM, do not provide necessary capabilities to let YourKit Java Profiler function in the attach mode. To profile them, start application with the profiler agent.
Attach may fail due to insufficient access rights. For example, it may not be possible to attach to a Java server running as a Windows service. If attempt to attach fails, start the application with the profiler agent instead.
A long pause is possible on first attempt to start CPU tracing or object allocation recording, because classes loaded before the profiler agent has attached need to be instrumented. Depending on application, it can take from several seconds to several tens of seconds, or even a few minutes in worst cases.
The good news is that there will be no pause on subsequent starts of CPU tracing or object allocation recording for the same running JVM instance.
No profiling results for some methods:
- JVM may not be able to apply bytecode instrumentation to methods of the objects that have been created before the agent attached. Instead, the old, non-instrumented version of the bytecode will keep running for them. This is a limitation of the JVM.
- Another JVM limitation is that native methods of classes that have loaded before the profiler agent attached cannot be instrumented at all. (There is no problem with classes loaded after the profiler has attached.)
This means that their calls will be missing in:
- CPU tracing results (no problem for CPU sampling as it does not depend on bytecode instrumentation)
- results of probes depending on instrumentation of those methods, in particular, in the "Events" and "Performance Charts" views
- Exception profiling is not available.