Allow profile widget builds in profile mode#30990
Conversation
Previously, such function is only available in the debug mode. But the performance information is very noisy in debug mode with JIT. I feel that such function is as important and useful as the performance overlay and the `--trace-skia` option for the GPU thread. So we should give it the same ability to run in both profile and debug mode. I've tested it using flutter_gallery in the profile mode. There's no observable difference in the performance overlay between toggling widget build profiling.
| } | ||
|
|
||
| // Expose the ability to send Widget rebuilds as [Timeline] events. | ||
| registerBoolServiceExtension( |
There was a problem hiding this comment.
This needs to be behind the kReleaseMode flag
There was a problem hiding this comment.
It looks like this is outside of the flag still
There was a problem hiding this comment.
Oops, sending another patch.
| Timeline.startSync('${widget.runtimeType}', arguments: timelineWhitelistArguments); | ||
| return true; | ||
| }()); | ||
| if (debugProfileBuildsEnabled) |
There was a problem hiding this comment.
This also needs to be behind the kReleaseModeFlag
| return true; | ||
| } else if (character == 'a') { | ||
| if (supportsServiceProtocol && isRunningDebug) { | ||
| if (supportsServiceProtocol && (isRunningDebug || isRunningProfile)) { |
There was a problem hiding this comment.
this is equivalent to checking for supportsServiceProtocol
| printStatus('To dump the accessibility tree (debugDumpSemantics), press "S" (for traversal order) or "U" (for inverse hit test order).'); | ||
| } | ||
| printStatus('To display the performance overlay (WidgetsApp.showPerformanceOverlay), press "P".'); | ||
| if (isRunningProfile || isRunningDebug) { |
There was a problem hiding this comment.
I believe this check not required, since these do not show up when running release?
liyuqian
left a comment
There was a problem hiding this comment.
Thanks @jonahwilliams for the comments!
| Timeline.startSync('${widget.runtimeType}', arguments: timelineWhitelistArguments); | ||
| return true; | ||
| }()); | ||
| if (debugProfileBuildsEnabled) |
| } | ||
|
|
||
| // Expose the ability to send Widget rebuilds as [Timeline] events. | ||
| registerBoolServiceExtension( |
| return true; | ||
| } else if (character == 'a') { | ||
| if (supportsServiceProtocol && isRunningDebug) { | ||
| if (supportsServiceProtocol && (isRunningDebug || isRunningProfile)) { |
| printStatus('To dump the accessibility tree (debugDumpSemantics), press "S" (for traversal order) or "U" (for inverse hit test order).'); | ||
| } | ||
| printStatus('To display the performance overlay (WidgetsApp.showPerformanceOverlay), press "P".'); | ||
| if (isRunningProfile || isRunningDebug) { |
|
LGTM once Jonah's comments are addressed. |
|
@jonahwilliams : has the new patch addressed all your comments? |
| ); | ||
| } | ||
|
|
||
| // Expose the ability to send Widget rebuilds as [Timeline] events. |
There was a problem hiding this comment.
Nit: place these with the extensions above.
Description
Previously, such function is only available in the debug mode. But the
performance information is very noisy in debug mode with JIT. I feel
that such function is as important and useful as the performance overlay
and the
--trace-skiaoption for the GPU thread. So we should give itthe same ability to run in both profile and debug mode.
I've tested it using flutter_gallery in the profile mode. There's no
observable difference in the performance overlay between toggling widget
build profiling.
Related Issues
#30984
Tests
I haven't found any test for the keyboard command of
ResidentRunner. I'd love to add a test for it if someone could teach me how to write one.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?