- 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
- CPU usage estimation
- Asynchronous sampling
- Call counting
- CPU tab
- What-if: an ability to ignore particular methods or focus on particular methods only
- Comparing performance snapshots
- Sampling settings
- Tracing settings
- 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
- IDE integration
- 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?
Asynchronous sampling is a CPU profiling mode which provides much better accuracy of collected stack traces and lower overhead than the classic synchronous sampling.
Asynchronous sampling is a low overhead profiling mode that does not suffer from Safepoint bias problem. It features HotSpot-specific APIs to collect stack traces. It works with OpenJDK, Oracle JDK and other Java runtimes based on the HotSpot JVM. This mode available only on a limited number of platforms.
Asynchronous sampling is available in two modes: asynchronous CPU sampling and asynchronous periodic sampling.
Asynchronous CPU sampling
Unlike classic synchronous sampling which periodically queries stacks of all application threads, asynchronous CPU sampling works differently. The profiler sets a timer which counts down against the both user and system CPU time consumed by all threads in the process. As soon as the counter exceeds the pre-defined CPU time threshold, the profiler collects the call stack in the thread which caused the timer expiration.
Asynchronous CPU sampling always measures CPU time. Due to the nature of system CPU timers wall time cannot be measured.
Time measurement accuracy is high for methods consuming CPU cycles.
which don't consume CPU time will not be shown in the results.
Asynchronous periodic sampling
Like classic synchronous sampling, the asynchronous periodic sampling also periodically queries stacks of all application threads.
Unlike classic synchronous sampling, the asynchronous periodic sampling does not do it by obtaining all thread stacks at a time, but instead periodically sends a signal to each live thread to accurately sample its own stack.
Like classic synchronous sampling and unlike asynchronous CPU sampling, asynchronous periodic sampling measures CPU or wall time depending on the sampling settings.
Starting asynchronous sampling
Use profiler toolbar to start asynchronous sampling as shown on the picture below. There are also alternate methods to start CPU profiling.
- HotSpot JVM.
- Linux: x64, x86, ARM 32-bit (ARMv7 and higher, hard-float), ARM 64-bit (AArch64), ppc64le
- macOS: x64, arm64
Asynchronous sampling overhead is lower than in other sampling modes and lower than overhead of tracing. However, the probes for the high-level statistics, if enabled, may impose additional overhead.
See also: Profiling overhead: how to reduce or avoid.
Asynchronous profiling can be configured with the sampling settings.
Asynchronous CPU sampling:
Configure the CPU time threshold by using the property
- Configure the CPU time threshold by using the property
Asynchronous periodic sampling:
Configure the sampling period by using the property
Choose between measuring CPU time (default) or wall time by using the property
- Configure the sampling period by using the property
Disabling asynchronous sampling
Asynchronous sampling will be disabled if the startup option
disableall is specified.