Repository navigation
Fix arm64/aarch64 support by aligning async-profiler's clock with the JVM's - #33
Merged
Merged
Conversation
With jfrsync=..., async-profiler appends its chunk to the JVM's
recording, and JDK 22+ readers convert every chunk of a file with the
first chunk's clock origin. On aarch64 the JVM counts JFR ticks from
its own start and async-profiler counted them from the boot, so the
correlator's JFR reader placed every SignalSample, CPU and allocation
sample days after the recording and rejected them all as outside the
selected window ("matched 0, outside the selected JFR window").
The submodule moves to the async-profiler commit that aligns the
monotonic clock with the JVM's JFR clock whenever the JVM counts
nanoseconds, synchronizes the time stamp counter with the JVM only on
x86, and warns under jfrsync when the clocks can't be aligned.
SignalSample.monotonicTimeNanos stays raw CLOCK_MONOTONIC for the
kernel-side joins.
Assisted-by: Claude Code (claude-opus-5-5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Profiling with
jfrsyncon arm64 lost every async-profiler and jonoffcpu event from time-based analysis:CLOCK_MONOTONICfrom the boot. Each chunk's header was right on its own.ChunkParserreuses the first chunk'sTimeConverter). A whole-recording reader therefore placed async-profiler's events days after the recording: 672,402 s on an OrbStack host.SignalJfrExporterreads withRecordingFileand filters ongetStartTime(). On an Apache Pulsar broker capture it reported "matched 0, outside the selected JFR window 83376".This PR moves the
async-profilersubmodule to jonoffcpu/async-profiler@2e1e0f1, "Align the monotonic clock with the JVM's JFR clock", now the head of the fork'sjonoffcpu-devbranch.Changes in async-profiler
JVM.counterTime(), and subtracts the offset fromCLOCK_MONOTONIC.clock=monotonic.cntvct_el0could be picked while the JVM counted nanoseconds.Recording.timestamp()reads the JVM's clock whenever the profiler's clock is aligned with it.clock=monotonicon a JVM that uses the time stamp counter.SignalSample.monotonicTimeNanosstays rawCLOCK_MONOTONIC. OnlystartTimemoves to the JVM's origin, and the correlator's kernel-side checks keep working.Testing
JfrTests.clockAlignment: reads ajfrsyncrecording with the JDK'sRecordingFileand checks that every event falls within the recording. It has three cases: default,-XX:-UseFastUnorderedTimeStamps, andclock=monotonic.jfr,span,api,signal,wallandsmokesuites pass on linux-aarch64 JDK 25../gradlew -Pversion=0.8.0-SNAPSHOT -PnativeArchitectures=arm64 -PnativeLibcs=all publishToMavenLocalbuilt both bundled libraries (glibc and musl) with the change.SpanTests.apiandJfrTests.clockSource/tscfail with and without the change.