- System requirements
- Profiler architecture
- Profiler installation
- Uninstall profiler
- Running the profiler
- Profiler activation
- Welcome screen
- Start profiling
- Profiling overhead
- Snapshots
- Solving performance problems
- CPU profiling
- CPU and wall times when profiling Java applications
- CPU profiling modes
- CPU usage estimation
- CPU sampling
- Asynchronous CPU sampling
- CPU sampling settings
- CPU tracing
- CPU tracing settings
- Call counting
- CPU tab
- What-if: an ability to ignore particular methods or focus on particular methods only
- Thread profiling
- Virtual threads support
- Deadlock detector
- Memory profiling
- Garbage collection
- Monitor profiling
- Exception profiling
- Telemetry
- Probes: monitor events of various kinds
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Automatic deobfuscation
- Summary
- Filters
- Profiler command line
- Export of profiling results to external formats
- Profiler Java API
- Profiler HTTP API
- Settings
- Troubleshooting and FAQ
Asynchronous CPU sampling
Asynchronous sampling is a CPU profiling mode which provides much better accuracy of collected stack traces and lower overhead than the classic synchronous CPU sampling.
Asynchronous CPU sampling is a low overhead profiling mode that does not suffer from a 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 is available only on a limited number of platforms.
Asynchronous sampling is available in two modes: asynchronous CPU sampling and asynchronous periodic CPU 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 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.
Methods like
sleep()
and
wait()
which don't consume CPU time will not be shown in the results.
Asynchronous periodic CPU 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 CPU sampling
Use profiler toolbar to start asynchronous sampling as shown on the picture below. There are also alternate methods to start CPU profiling.

System requirements
- HotSpot JVM.
-
Operating systems:
- Linux: x64, x86, ARM 32-bit (ARMv7 and higher, hard-float), ARM 64-bit (AArch64), ppc64le
- macOS: x64, arm64
Overhead
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.
Sampling settings
Asynchronous profiling can be configured with the sampling settings.
-
Asynchronous CPU sampling:
-
Configure the CPU time threshold by using the property
cpu_threshold_ms
.
-
Configure the CPU time threshold by using the property
-
Asynchronous periodic sampling:
-
Configure the sampling period by using the property
sampling_period_ms
. -
Choose between measuring CPU time (default) or wall time by using the property
time
.
-
Configure the sampling period by using the property
Disabling asynchronous sampling
Asynchronous sampling will be disabled if the startup option
disable_async_sampling
or
disable_all
is specified.