Async-profiler is a sampling CPU and heap profiler for Java that addresses the safepoint bias problem inherent in traditional Java profilers.
The tool works by using HotSpot-specific APIs to collect stack traces and track memory allocations without the overhead and bias limitations of conventional sampling approaches. Unlike traditional profilers, it monitors non-Java threads such as GC and JIT compiler threads, and includes native and kernel frames in its stack traces. This capability to see the full picture of what the JVM and its supporting systems are doing makes it possible to identify performance bottlenecks that other profilers miss. The profiler can track CPU time, heap allocations, native memory allocations and leaks, contended locks, and hardware performance counters including cache misses, page faults, and context switches.
Async-profiler suits teams working with OpenJDK or HotSpot-based Java runtimes who need accurate performance visibility without the distortions introduced by safepoint-based sampling. It is particularly valuable when investigating performance issues that involve garbage collection, JIT compilation, or native code, or when you need to understand memory allocation patterns. The tool is straightforward to use, requiring only a running Java process PID to begin profiling, and outputs results as interactive flame graphs viewable in a browser.
The project maintains official builds for Linux x64 and arm64, and macOS x64 and arm64, with additional community ports available for other architectures. The codebase is written in C++ and requires GCC or Clang for building, along with JDK 11 or later. The project provides nightly builds from the latest successful commits alongside stable releases, allowing users to access recent improvements or test against development versions. The build system is straightforward, using make with clear targets for testing and packaging binaries for distribution.