-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
web: implement frame timings #21552
web: implement frame timings #21552
Conversation
} | ||
|
||
void testMain() { | ||
setUpAll(() async { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 'the' work
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But good catch!
Responded to all comments. PTAL. |
There was a problem hiding this 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.
* web: implement frame timings
Implement
window.onReportTimings
for web.