DingliZhang 7e34543e9d Fix VMStructs stack walking on RISC-V
RISC-V points FP at the sender SP instead of at the saved FP, so the frame
link pair lives below FP (frame_riscv.hpp: link_offset = -2,
return_addr_offset = -1). The stack walker assumed the x86/AArch64 layout,
and the interpreter frame offsets were hardcoded to the AArch64 values.

_interpreter_frame_bcp_offset was never set on RISC-V, so hasStackStructs()
returned false and cstack=vm was rejected. The profiler silently fell back
to AsyncGetCallTrace, which cannot walk StubRoutines frames: on a SPECjbb-like
workload 95% of the samples ended up in [unknown_Java], and inlined methods
were never expanded from the nmethod scopes.

Also teach unwindStub() about the two RISC-V stub prologues - the frame link
pushed by MacroAssembler::enter() and the plain SP decrement used by leaf
stubs - and implement unwindPrologue()/unwindEpilogue().

Measured with itimer sampling on qemu-riscv64, JDK 28: [unknown_Java] drops
from 94.9% to 0%, and arraycopy/md5/sha/crc32 stubs now resolve to the same
Java caller chains as x86_64. The x86_64 and AArch64 binaries are unchanged.
2026-08-30 08:44:25 +08:00
2026-08-30 08:44:25 +08:00
2019-01-05 01:42:09 +03:00
2026-07-21 00:02:30 +01:00
2025-05-07 03:16:58 +01:00
2016-04-23 04:27:15 +03:00
2026-07-13 18:25:37 +01:00
2026-07-21 00:02:30 +01:00
2025-05-07 03:16:58 +01:00

Async-profiler

This project is a low overhead sampling profiler for Java that does not suffer from the Safepoint bias problem. It features HotSpot-specific API to collect stack traces and to track memory allocations. The profiler works with OpenJDK and other Java runtimes based on the HotSpot JVM.

Unlike traditional Java profilers, async-profiler monitors non-Java threads (e.g., GC and JIT compiler threads) and shows native and kernel frames in stack traces.

What can be profiled:

  • CPU time
  • Allocations in Java Heap
  • Native memory allocations and leaks
  • Contended locks
  • Hardware and software performance counters like cache misses, page faults, context switches
  • and more.

See our 3 hours playlist to learn about more features.

Download

Stable release: 4.5

Nightly builds

The most recent binaries corresponding to the latest successful commit in master.

For a build corresponding to one of the previous commits, go to Nightly Builds, click the desired build and scroll down to the artifacts section. These binaries are kept for 30 days.

Quick start

In a typical use case, profiling a Java application is just a matter of a running asprof with a PID of a running Java process.

$ asprof -d 30 -f flamegraph.html <PID>

The above command translates to: run profiler for 30 seconds and save results to flamegraph.html as an interactive Flame Graph that can be viewed in a browser.

FlameGraph

Find more details in the Getting started guide.

Building

Build status

Build Status

Minimum requirements

  • make
  • GCC 7.5.0+ or Clang 7.0.0+
  • Static version of libstdc++ (e.g. on Amazon Linux 2023: yum install libstdc++-static)
  • JDK 11+

How to build

Make sure gcc, g++ and java are available on the PATH. Navigate to the root directory with async-profiler sources and run make. async-profiler launcher will be available at build/bin/asprof.

Other Makefile targets:

  • make test - run unit and integration tests;
  • make release - package async-profiler binaries as .tar.gz (Linux) or .zip (macOS).

Supported platforms

Officially maintained builds Other available ports
Linux x64, arm64 x86, arm32, ppc64le, riscv64, loongarch64
macOS x64, arm64

Documentation

Basic usage

Profiler output

Advanced usage

Troubleshooting

For known issues faced while running async-profiler and their detailed troubleshooting, please refer here.

S
Description
Sampling CPU and HEAP profiler for Java featuring AsyncGetCallTrace + perf_events
Readme Apache-2.0 33 MiB
v4.2.1 Latest
2025-11-18 17:30:09 +00:00
Languages
C++ 55.1%
Java 28%
HTML 12.1%
C 3.6%
Makefile 0.8%
Other 0.4%