-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[NativeAOT] Add sampling profiler #108083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
@LakshanF do you think we'd be able to implement the rest? If there is a rundown for this, we do have names of methods available in stack trace metadata. If the rundown can run managed code, we could get it there. Maybe. Depending on what actually involves the rundown. |
I only tried to run it with Stack trace metadata sound like an interesting thing to try... |
There is a work item in the diagnostic repo to lookup type information for native AOT GCDump, which could be expanded to include method information as well. |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
This is useful on its own - without this, |
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.
Thank you!
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.
Pull Request Overview
This PR introduces a basic sampling profiler for NativeAOT by adding helper methods and integrating stack walking logic.
- Added a new GetTransitionFrameForSampling method in thread.h
- Extended the sampling event capture logic in ep-rt-aot.cpp
- Introduced a GetControlPC method in StackFrameIterator.h
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/coreclr/nativeaot/Runtime/thread.h | Added a helper method to support sampling profiler functionality |
src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp | Integrated sampling profiler logic to capture stack frames and emit events |
src/coreclr/nativeaot/Runtime/StackFrameIterator.h | Exposed the control PC via a new method for use by the profiler |
Comments suppressed due to low confidence (3)
src/coreclr/nativeaot/Runtime/thread.h:323
- Consider adding a brief comment to clarify the purpose and usage of GetTransitionFrameForSampling for future maintainability.
PInvokeTransitionFrame* GetTransitionFrameForSampling() { return GetTransitionFrame(); }
src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp:113
- [nitpick] Clarify or document in a tracking issue whether the differentiation between managed and external code will be addressed later to improve future code maintainability.
// TODO: We can actually detect whether we are in managed or external code but does it matter?!
src/coreclr/nativeaot/Runtime/StackFrameIterator.h:58
- Consider adding a comment to describe the role of GetControlPC in the sampling process to aid future maintainers.
PTR_VOID GetControlPC() { return m_ControlPC; }
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/ba-g the arm32 build break was fixed and the rest are known |
Presumably this is pretty useless since we don't do the rundown to get readable method names... but since I already have it laying around, anyone can think of a use for this?