KEMBAR78
improve terminate logic in dwarf and vm stack walking mode by visheshruparelia · Pull Request #1393 · async-profiler/async-profiler · GitHub
Skip to content

Conversation

visheshruparelia
Copy link
Contributor

@visheshruparelia visheshruparelia commented Jul 15, 2025

Description

In Alpine, we have seen cases where unwinding does not terminate properly (only terminates after we reach maxDepth value). This results in flamegraphs with a lot of "duplicate" frames. This happens because during unwinding, the next "pc" is always equal to current "pc" after a certain point.
In this PR, we add a check where we terminate the unwinding if prev_sp == new_sp and prev_pc == new_pc.

Related issues

N/A

How has this been tested?

Attached are before and after images of flame graphs for CPU profiling for this application in Alpine

Before

image

After

image

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

@visheshruparelia visheshruparelia marked this pull request as ready for review July 15, 2025 14:34
@apangin apangin merged commit 80ae8ae into async-profiler:master Jul 15, 2025
20 checks passed
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.

2 participants