Skip to content

Timeline view refactoring #20

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

Merged
merged 10 commits into from
Sep 24, 2018
Merged

Conversation

devoncarew
Copy link
Member

@devoncarew devoncarew commented Sep 20, 2018

  • move the timeline protocol parsing code into its own library
  • handle and display additional timeline events (show async events now)
  • change how we look for frames in the timeline events (for the Dart portion, look for PipelineProduce; for the GPU portion, look for MessageLoop::RunExpiredTasks
  • add tests for the event parsing

This does a better job of determining where frames are in the event stream, and displays more info in the timeline view.

@DanTup

@override
String toString() => '[$category] [$phase] $name';
HelpInfo get helpInfo =>
new HelpInfo(title: 'timeline docs', url: 'http://www.cheese.com');
Copy link
Contributor

Choose a reason for hiding this comment

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

There should probably be a TODO to update this 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

will add


TimelineFrame();
while (dartEvents.length > 1 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be >= 1? Otherwise a single item that doesn't meet the criteria might be left?

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, we know that there are no gpu samples that start before the dart ones. What we're doing here is making sure there's just one dart sample that starts before the gpu ones, and that it's the latest dart sample.

}
frames.add(frame);
if (frames.length > maxFrames) {
frames.removeAt(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

If this code is called a lot, we may have the same perf concerns as logging - removing the first item repeatedly might be expensive (I'm assuming, I haven't checked the implementation). We might want to do the same (remove in batches), or it may be worth us making a custom list that's just a fixed array that overwrites the oldest items (so there are no resizes) and just offsets indexing operations/enumeration.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this'll be OK as frames will likely just come in every 1/60 of a second. I made a note about the UI respecting the maxFrames list - which it doesn't currently. We will want to profile this for a 60 fps animating app, to make sure that the UI (and dom manipulations we do) can keep up with that rate of frames.

}

switch (event.phase) {
case 'B':
Copy link
Contributor

Choose a reason for hiding this comment

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

For my curiosity - are these documented anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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


int get category {
if (name.endsWith('.ui')) {
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks strange that category is ints - would an enum work? Or if used only for sorting, maybe naming it sortCategory or sortPriority or something might be clearer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Dart enums are a bit underwhelming - agree that something a bit more semantic here would be better. I'll rename to sortPriority.

@devoncarew devoncarew merged commit 788ea93 into flutter:master Sep 24, 2018
hrajwade96 pushed a commit to hrajwade96/devtools that referenced this pull request Dec 18, 2024
Add feature to pause auto play when user input is detected
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.

2 participants