Repository navigation
Keep native frames intact under --package-names - #5
Merged
Merged
Conversation
stacks --package-names abbreviate|drop rewrote the native frames async-profiler
records inside the Java stack: libjvm.so.Unsafe_Park became l.so.Unsafe_Park or
so.Unsafe_Park, losing the library and merging symbols of different
libraries. The collapsed key drops each frame's type, the profile tagged every
Java-stack frame JAVA, and the package pattern read "libjvm." as a package.
- The correlator records which frames of each collapsed key async-profiler
typed as Java code (Interpreted, JIT compiled, C1 compiled, Inlined). Stacks
that share a key must agree for a frame to count as Java.
- The profile tags the others with a new frame kind, JFR_NATIVE (wire value
4), and moves to schema_version 2. Schema 1 profiles still read; an older
correlator refuses a new profile with "Unsupported stack profile schema".
merge combines stacks with the same names whatever kinds its inputs gave
them, and a frame any input calls native stays native.
- --package-names only rewrites JAVA frames. A name rule protects schema 1
profiles and backs up the kinds: a name with "::", a shared-library segment
(".so.", ".so.6."), a leading "/" or "[", or a space is never rewritten.
- A hidden class's ".0x..." suffix (Foo$$Lambda.0x0000000081a16ff8.run) now
stays part of the class, so drop removes its package too.
- export adds a last column, java_stack_kinds (javaStackKinds in JSON Lines),
with java or native per frame. Existing columns are unchanged.
Collapsed keys and frame names are unchanged, so the default rendering still
reproduces jonoffcpu-offcpu-stacks.collapsed byte for byte. On a Pulsar broker
profile, the old code produced 1,844 so./l.so. frame occurrences under
abbreviate and drop; now all 264 native frames keep their names, and filter
totals are identical in all three modes.
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.
Problem
stacks --package-names abbreviate|drop(#4) promises to change only package-qualified Java frames, but it rewrote most native frames that async-profiler records inside the Java stack:abbreviate(before)drop(before)libjvm.so.Unsafe_Parkl.so.Unsafe_Parkso.Unsafe_Parklibjvm.so.ZWorkers::runl.so.ZWorkers::runso.ZWorkers::runlibnio.so.Java_sun_nio_ch_EPoll_waitl.so.Java_sun_nio_ch_EPoll_waitso.Java_sun_nio_ch_EPoll_waitThe library is the only thing that says whether
runbelongs to HotSpot, a JNI library or the profiler. The rewrite replaced it withso., and symbols from different libraries could merge. There were three causes:JAVA;libjvm.as a package.Change
Interpreted,JIT compiled,C1 compiled,Inlined). If stacks that share a key disagree about a frame, that frame counts as native.JFR_NATIVE(wire value 4), and moves toschema_version2.Unsupported stack profile schema.mergecombines stacks with the same frame names whatever kinds its inputs gave them, and a frame any input calls native stays native.JAVAframes are rewritten. A name rule protects schema 1 profiles and backs up the kinds: a name with::, a shared-library segment (.so.,.so.6.), a leading/or[, or a space is never rewritten..0x…suffix (Foo$$Lambda.0x0000000081a16ff8.run) now stays part of the class, sodropremoves its package too. Before, these frames kept their full package.exportadds a last column,java_stack_kinds(javaStackKindsin JSON Lines), holdingjavaornativeper frame. Existing columns are unchanged.OFFLINE.mdand README §5 are updated. README §5 gains a table that includes a native row.Collapsed keys and frame names are unchanged, so the default rendering still reproduces
jonoffcpu-offcpu-stacks.collapsedbyte for byte.Verification
./gradlew spotlessCheck :jonoffcpu-correlator:checkpasses. The new fixtures cover:merge;abbreviateanddropproduced 1,844so./l.so.frame occurrences. Now there are none.fullrender keep their names in both modes.fullrenders are byte-identical to the old correlator's.--excludesummary totals are identical in all three modes.Unsupported stack profile schema.