GeezerVison is showing github.com — Support advanced stack walking features with cstack=vm by apangin · Pull Request #1537 · async-profiler/async-profiler
Conversation
Description
This PR is a prerequisite to making cstack=vm the default stack walking mode.
It includes the following changes:
vm and vmx are no longer different stack walking modes. It's now a single vm mode with an optional mixed feature. There is already -F argument for choosing various stack walking features, and the ability to display mixed stack (where native frames interleave Java frames) fits this paradigm well. cstack=vmx remains for backward compatibility as a shorthand for cstack=vm,features=mixed.
StackDetail enum is gone. Now, I pass features argument instead.
- VMStructs stack walker now supports
vtable and comptask features.
- For
nativemem profiles, I chop everything above malloc hook frames, similarly to fp and dwarf modes.
I haven't changed logic around allocation and lock profiling. They still use JVMTI API for getting stack traces. This will keep familiar user experience after switching to vm by default.
Related issues
#1533, #1370
Motivation and context
VMStructs should support all stack walking features that fp and dwarf modes do.
How has this been tested?
--cstack vm -F comptask+vtable
Integration tests will be amended in the subsequent PR that changes default mode.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I haven't changed logic around allocation
But wouldn't that keep the known issue of allocation profiling not collecting native samples for alloc samples when vm is selected?
For example the following samples
When using VM stack walker they won't have these native frames,
This is because we're skipping native portion for vm on the Profiler::getNativeTrace function & only collect the java samples using the JVMTI stack walker
You can test this change against the AllocTests.startup I think it will fail if you enable vm
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
}
|
|
|
continue;
|
|
|
} else {
|
|
|
if (features.vtable_target && nm->isVTableStub() && depth == 0) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test for this?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for vtable stub and itable stub
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@Baraa-Hasheesh You are right: ideally, allocation profiling should use VMStructs stack walker too. But let's do it in a separate PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@Baraa-Hasheesh You are right: ideally, allocation profiling should use VMStructs stack walker too. But let's do it in a separate PR.
That's should be fine
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 15, 2025
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|