Repository navigation
Abbreviate or drop Java package names when rendering stacks - #4
Merged
Merged
Conversation
stacks --package-names full|abbreviate|drop changes how Java frames are shown: abbreviate cuts each package segment to its first letter (io.netty.channel.epoll.Native.epollWait0 becomes i.n.c.e.Native.epollWait0) and drop keeps Class.method. Frames that are not package-qualified Class.method names are left unchanged. Only the display changes: filters still match the full names, lines that become identical are summed, and the summary records the mode. full is the default, so the default rendering still reproduces the collapsed file byte for byte.
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.
Why
Java frames in a flame graph are dominated by their package names.
io.netty.channel.epoll.Native.epollWait0is mostlyio.netty.channel.epoll., which leaves little room in a frame's box for the class and method that say what it is.What changes
jonoffcpu-correlator.jar stacksgains--package-names full|abbreviate|drop:io.netty.channel.epoll.Native.epollWait0becomesfull(default)io.netty.channel.epoll.Native.epollWait0abbreviatei.n.c.e.Native.epollWait0dropNative.epollWait0Class.methodframes are changed. Nested and hidden classes keep their names (a.Outer$Inner.<init>,j.l.i.LambdaForm$MH/0x….invoke). Anything else — native frames such asepoll_waitorlibc.so.6,[stack unavailable], and frames without a package — is left as it is.--include/--excludestill match the full names, so existing patterns keep working.app.one.Worker.parkandapp.two.Worker.parkunderdrop) merge into one line, and their time is summed.--summaryrecords the mode aspackageNames.fullis the default, so a default rendering still reproducesjonoffcpu-offcpu-stacks.collapsedbyte for byte.stacksoption, including--time.Verification
./gradlew spotlessCheck :jonoffcpu-correlator:checkpasses. A newStackProfileTestcase covers:drop;drop;fullreproduces the collapsed file byte for byte;abbreviateshrinks the file from 14.0 MB to 10.6 MB anddropto 9.1 MB, with the same total time.