Asynchronous sampling is an experimental CPU profiling mode, which provides much better accuracy of collected stack traces than classic sampling. Asynchronous sampling uses an experimental HotSpot API and system CPU timers. This mode available only on a limited number of platforms.
Unlike classic synchronous sampling which periodically queries stacks of all application threads, asynchronous sampling works different. 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 a counter exceeds pre-defined CPU time threshold profiler collects call stack in a thread which caused timer expiration.
Due to nature of CPU timers, wall time cannot be measured and methods like
which don't consume CPU time will not be shown in the results.
Time measurement accuracy is high for methods consuming the CPU time the most.
Use profiler toolbar to start asynchronous sampling as shown on the picture below. There are also alternate methods to start CPU profiling.
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.
To configure CPU time threshold use
CPU sampling property.