Skip to content

Allow profile widget builds in profile mode#30990

Merged
liyuqian merged 4 commits intoflutter:masterfrom
liyuqian:profile_build_in_profile
Apr 15, 2019
Merged

Allow profile widget builds in profile mode#30990
liyuqian merged 4 commits intoflutter:masterfrom
liyuqian:profile_build_in_profile

Conversation

@liyuqian
Copy link
Contributor

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-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.

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

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.
@liyuqian liyuqian added c: contributor-productivity Team-specific productivity, code health, technical debt. c: performance Relates to speed or footprint issues (see "perf:" labels) labels Apr 12, 2019
@liyuqian liyuqian requested a review from dnfield April 12, 2019 23:26
}

// Expose the ability to send Widget rebuilds as [Timeline] events.
registerBoolServiceExtension(
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be behind the kReleaseMode flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is outside of the flag still

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, sending another patch.

Timeline.startSync('${widget.runtimeType}', arguments: timelineWhitelistArguments);
return true;
}());
if (debugProfileBuildsEnabled)
Copy link
Contributor

Choose a reason for hiding this comment

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

This also needs to be behind the kReleaseModeFlag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

return true;
} else if (character == 'a') {
if (supportsServiceProtocol && isRunningDebug) {
if (supportsServiceProtocol && (isRunningDebug || isRunningProfile)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is equivalent to checking for supportsServiceProtocol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this check not required, since these do not show up when running release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor Author

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

Thanks @jonahwilliams for the comments!

Timeline.startSync('${widget.runtimeType}', arguments: timelineWhitelistArguments);
return true;
}());
if (debugProfileBuildsEnabled)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

// Expose the ability to send Widget rebuilds as [Timeline] events.
registerBoolServiceExtension(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

return true;
} else if (character == 'a') {
if (supportsServiceProtocol && isRunningDebug) {
if (supportsServiceProtocol && (isRunningDebug || isRunningProfile)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@dnfield
Copy link
Contributor

dnfield commented Apr 12, 2019

LGTM once Jonah's comments are addressed.

@liyuqian
Copy link
Contributor Author

@jonahwilliams : has the new patch addressed all your comments?

);
}

// Expose the ability to send Widget rebuilds as [Timeline] events.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: place these with the extensions above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@liyuqian liyuqian merged commit a8116e9 into flutter:master Apr 15, 2019
@liyuqian liyuqian deleted the profile_build_in_profile branch April 18, 2019 21:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. c: performance Relates to speed or footprint issues (see "perf:" labels)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants