Skip to content
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

Add Track Paints and Track Layouts toggles to the performance page. #3451

Merged
merged 4 commits into from
Oct 20, 2021

Conversation

kenzieschmoll
Copy link
Member

Screen Shot 2021-10-14 at 10 55 26 AM

IMO Adding these toggles crowds the button. Here a couple ideas:

  1. Never show text in Pause, Resume, Clear, and Export buttons. Text could be visible in the tooltip still.
  2. Put all the "Track XYZ" buttons into a dialog. The button to launch the dialog could say something like "Enhance Tracing" or similar, and in the dialog, the options to track builds, layouts, and paints would be accessible.

Thoughts? @cobblest @InMatrix @ayanogawa

When these new options are enabled, timeline events are added to for RenderObject paints and layouts respectively.
Screen Shot 2021-10-14 at 10 53 56 AM
CC @goderbauer

Depends on flutter/flutter#91822.

@InMatrix
Copy link

Never show text in Pause, Resume, Clear, and Export buttons. Text could be visible in the tooltip still.

This sounds reasonable, since those icons have pretty standard meanings.

Put all the "Track XYZ" buttons into a dialog.

How about a dropdown with check boxes?

Question: do these "Track XYZ" buttons work in both profile and debug modes or just debug mode? And how costly to turn on each? We might want to consider turning on some of those options by default in debug mode and proactively process the data to surface things worth the user's attention.

@kenzieschmoll
Copy link
Member Author

do these "Track XYZ" buttons work in both profile and debug modes or just debug mode?

Both debug and profile.

And how costly to turn on each? We might want to consider turning on some of those options by default in debug mode and proactively process the data to surface things worth the user's attention.

To my knowledge, we don't have any measurements on this. There is a cost, though I'm not sure how high. In general, I would expect that the more timeline events that are added, the higher the cost. So if a lot of widgets are built / painted / laid out for a frame, the higher the cost would be for these debugging toggles to be on. @goderbauer do you know if we have any measurements anywhere for the cost of enabling these debug flags? Or have you noticed a big discrepancy in performance with and without some of these flags enabled?

In general, I think these features should be used to enhance the trace, but are expected to skew measurements a bit.

@InMatrix
Copy link

InMatrix commented Oct 15, 2021

I'd love to see some sample data from "Track Paints" and "Track Layouts. Is there a way to generate some today?

In general, I think these features should be used to enhance the trace, but are expected to skew measurements a bit.

I'm interested in experimenting perf metrics other than time to render each frame in the debug mode. The data coming out of these three tracing options could be really useful to understand how much work of each type the system is doing. We can talk more in our Monday critique meeting.

@goderbauer
Copy link
Member

@goderbauer do you know if we have any measurements anywhere for the cost of enabling these debug flags?

I am not aware of the exact numbers, but enabling these noticeable slows down things. That's why we have them off by default. The idea is you'd only turn on e.g. "track layout" when you see that the layout is taking too long. The flag then allows you to dive deeper into it (but you no longer get accurate absolute performance numbers, you just see what's slower relative to other operations).

In general, I think these features should be used to enhance the trace, but are expected to skew measurements a bit.

100% agree

I'd love to see some sample data from "Track Paints" and "Track Layouts. Is there a way to generate some today?

You can manually set these to true before running your app and the additional traces will appear in the timeline:

https://github.com/flutter/flutter/blob/9570d353b3d2afc603920948533bb2e1215e783a/packages/flutter/lib/src/rendering/debug.dart#L110

https://github.com/flutter/flutter/blob/9570d353b3d2afc603920948533bb2e1215e783a/packages/flutter/lib/src/rendering/debug.dart#L131

@kenzieschmoll
Copy link
Member Author

Here is the updated UI after the last commit
Screen Shot 2021-10-19 at 3 00 09 PM

All buttons:
Screen Shot 2021-10-19 at 3 06 03 PM
When at least one of the tracing features are enabled, the button will show up as enabled (like the other service extension buttons)
Screen Shot 2021-10-19 at 3 00 19 PM

CC @johnpryan we'll want to document these perf debugging features and link to the docs from here.

@jacob314
Copy link
Contributor

Filed #3460 to track an idea for how to nudge users to enable these advanced tracing uptions.

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

@kenzieschmoll kenzieschmoll merged commit 72b955d into flutter:master Oct 20, 2021
@kenzieschmoll kenzieschmoll deleted the paint-layout-toggles branch October 20, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants