KEMBAR78
Fully use VM stack walker when selected & general enhancements for VM/VMX modes by Baraa-Hasheesh · Pull Request #1370 · async-profiler/async-profiler · GitHub
Skip to content

Conversation

@Baraa-Hasheesh
Copy link
Contributor

Description

In this PR, I move the stack unwinding to fully use VM stack walking mode when selected
Previously it would have different handling depending on which event was being profiled

Furthermore this PR includes multiple enhancements on the VM/VMX stackwalking modes which include

  • Skipping some async-profiler frames from the stack as those frames don't provide useful debugging information
  • Skipping some internal JVM methods that create noise without helping much in the profiling
  • augmenting the native stacks with comptask frames

VM/VMX samples comparison (Before vs After)

  • LOCK
    image
    image

  • ALLOC
    image
    image

  • Malloc
    image
    image

  • Comp Task (is Missing in current VM/VMX)
    image
    image

Related issues

#1369

Motivation and context

Fully expose the VM/VMX stack walkers when selected by the user

How has this been tested?

multiple new tests have been added, these tests fails without the changes & pass with them
make test


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

// Skip any frames above profiler hook methods
depth = 0;
fillFrame(frames[depth++], BCI_NATIVE_FRAME, method_name);
} else if (mark == MARK_COMPILER_ENTRY && Profiler::instance()->features().comp_task) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If mark == MARK_COMPILER_ENTRY and Profiler::instance()->features().comp_task is false, you are going to fall into the else statement and treat the frame as a normal native frame. Is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that's intended

@Baraa-Hasheesh
Copy link
Contributor Author

while doing some testing on VM/VMX across multiple systems I've found that some crashes may happen for synchronous events such as ALLOC & MALLOC,

This should be fixed before proceeding with this change

I will create a separate issue & change the PR to draft in the meantime

@Baraa-Hasheesh Baraa-Hasheesh marked this pull request as ready for review July 21, 2025 09:35
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

@krk
Copy link
Contributor

krk commented Oct 2, 2025

Furthermore this PR includes multiple enhancements on the VM/VMX stackwalking modes which include

Skipping some async-profiler frames from the stack as those frames don't provide useful debugging information
Skipping some internal JVM methods that create noise without helping much in the profiling
augmenting the native stacks with comptask frames

Could you split the enhancements into a new PR, to reduce the size of it?

Also, the images in the PR description produce HTTP 404 when clicked.

@Baraa-Hasheesh
Copy link
Contributor Author

Furthermore this PR includes multiple enhancements on the VM/VMX stackwalking modes which include
Skipping some async-profiler frames from the stack as those frames don't provide useful debugging information
Skipping some internal JVM methods that create noise without helping much in the profiling
augmenting the native stacks with comptask frames

Could you split the enhancements into a new PR, to reduce the size of it?

Also, the images in the PR description produce HTTP 404 when clicked.

The PR is relatively small
Most changes are test additions if you think about it

@Baraa-Hasheesh
Copy link
Contributor Author

Closing this PR as #1537 handles most of what's needed

Need to create a new change to move alloc profiling to use VM

Also I do remember having a discussion about moving method trace samples to it as well #1421 (comment)

@apangin correct me if I'm wrong about the method trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants