- Notifications
You must be signed in to change notification settings - Fork4.4k
[9.0.0] Don't copy callstacks in the CPU profiler#28034
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:release-9.0.0
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The CpuProfiler doesn't retain the call stack and it's method is invoked synchronously, so there is no need for a copy.Closesbazelbuild#28021.PiperOrigin-RevId: 845694649Change-Id: I825b3020467129e8dd20ac63c6ca0d6a8ca22cab
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.
Code Review
This pull request introduces a performance optimization in the CPU profiler by avoiding an unnecessary copy of the call stack when recording a profile event. The change modifiesCpuProfiler.addEvent andPprofWriter.writeEvent to accept aList<? extends Debug.Frame> instead of anImmutableList<Debug.Frame>, allowing theStarlarkThread's internalcallstack to be passed directly without creating a defensive copy. This is safe because the call stack is processed synchronously within a synchronized method, preventing concurrent modification issues. The changes are correct and should improve the efficiency of CPU profiling.
The CpuProfiler doesn't retain the call stack and it's method is invoked synchronously, so there is no need for a copy.
Closes#28021.
PiperOrigin-RevId: 845694649
Change-Id: I825b3020467129e8dd20ac63c6ca0d6a8ca22cab
Commitc0f2078