Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

web: implement frame timings#21552

Merged
yjbanov merged 3 commits intoflutter:masterfrom
yjbanov:frame-timings
Oct 3, 2020
Merged

web: implement frame timings#21552
yjbanov merged 3 commits intoflutter:masterfrom
yjbanov:frame-timings

Conversation

@yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Oct 1, 2020

Implement window.onReportTimings for web.

@yjbanov yjbanov requested review from ferhatb and nturgut October 1, 2020 23:55
}

void testMain() {
setUpAll(() async {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test gives an error for ios-safari. logs

00:15 �[32m+363�[0m�[33m ~157�[0m�[31m -1�[0m: test/canvaskit/frame_timings_test.dart: (setUpAll) �[1m�[31m[E]�[0m�[0m                                                                                                                             
  ReferenceError: Can't find variable: WebAssembly
  ../src/engine/canvaskit/initialization.dart 37:5 

Can we skip the test? Safari desktop tests are passing btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, right! Done.

frameDone.complete();
};

// Frame 1
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I have told all comments have to end with a '.' (same for frame 2)

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.

await frameDone.future;
expect(timings, hasLength(2), reason: '100 ms passed. 2 frames pumped.');
for (final ui.FrameTiming timing in timings) {
expect(timing.vsyncOverhead, greaterThanOrEqualTo(Duration.zero));
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Is there a logical limit we can add? Or the value being more than zero is the only condition we are sure of.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test runs in real-time, so the actual number is unpredictable. Setting any upper limit may result in flakiness.

///
/// This also means different things between HTML and CanvasKit renderers.
///
/// In HTML "rasterization" only captures DOM updates, but not work that
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: 'the' work

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.

}
}

/// Current timestamp in microseconds taken from the high-precision
Copy link
Contributor

@nturgut nturgut Oct 2, 2020

Choose a reason for hiding this comment

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

I don't know how we are going to save/upload these values once we are running the tests. I remember we mentioned in the future we want to run them in Firefox as well. I found this comment for firefox in the mozilla docs. We might want to keep it somewhere: "Firefox rounds the returned time to 1 millisecond increments."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the "Reduced time precision" section they explain how you can enable high precision timers. Worst case we just ignore data from Firefox if it's not useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But good catch!

@yjbanov
Copy link
Contributor Author

yjbanov commented Oct 2, 2020

Responded to all comments. PTAL.

Copy link
Contributor

@nturgut nturgut left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding me as a reviewer.

@yjbanov yjbanov merged commit 94af181 into flutter:master Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2020
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request Oct 20, 2020
* web: implement frame timings
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants