Skip to content

Conversation

@goderbauer
Copy link
Member

Some Elements in the framework and in the outside world call inflateWidget directly instead of going through updateChild to inflate widgets. Widgets inflated that way did not show up in tracing with debugProfileBuildsEnabled because only updateChild was instrumented with tracing. This PR moves the instrumentation to inflateWidget to trace all widgets inflations - whether they are triggered via updateChild or directly via inflateWidget.

The most notable Element in the framework that's going straight to inflateWidget is MultiChildRenderObjectElement:

final Element newChild = inflateWidget(multiChildRenderObjectWidget.children[i], IndexedSlot<Element?>(i, previousChild));

MultiChildRenderObjectElement powers common widgets like Row, Column, and Stack among many others - all of which had their direct children omitted from traces. But no more!

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Feb 11, 2022
Element inflateWidget(Widget newWidget, Object? newSlot) {
assert(newWidget != null);

if (!kReleaseMode && debugProfileBuildsEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

are profiles even useful with this much debug code running?

Copy link
Member Author

Choose a reason for hiding this comment

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

In profile mode, this will only add the Widget's name to the timeline if debugProfileBuildsEnabled is manually enabled. (Only in debug mode do you also get extra "timeline arguments" from the diagnostics mode...)

It's sort of the point of the debugProfileBuildsEnabled option to get you that extra information in profile mode at the expense of skewing with performance numbers, which is documented on the flag.

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

@zanderso
Copy link
Member

@goderbauer goderbauer deleted the fixTracing branch February 15, 2022 17:22
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants