Bug 170198

Summary: MotionMark tests using Date.now() to drive animations don't work under web-page-replay
Product: WebKit Reporter: vmiura
Component: Tools / TestsAssignee: vmiura
Status: NEW ---    
Severity: Normal CC: buildbot, cdumez, jonlee, lforschler, mjs, rniwa, sabouhallawa, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch mjs: review-

Description vmiura 2017-03-28 13:57:03 PDT
A number of the MotionMark tests animate properties based on the Date.now() value.  This is via utility methods Stage.dateCounterValue() or Stage.dateFractionalValue().

Chromium's web-page-replay stubs out Date.now() to improve page replay determinism, and this breaks the animation progression on some of the tests.

Would it make sense to replace the Data.now() usage with consistent use of the Benchmark.timestamp()?
Comment 1 vmiura 2017-03-28 16:47:14 PDT
Created attachment 305671 [details]
Patch
Comment 2 Ryosuke Niwa 2017-03-28 16:51:40 PDT
Comment on attachment 305671 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305671&action=review

> PerformanceTests/ChangeLog:7
> +

Thanks for contributing the patch but please describe your change and add inline comments.
r- due to lack of change log comments.
Comment 3 vmiura 2017-03-28 17:30:14 PDT
Created attachment 305682 [details]
Patch
Comment 4 vmiura 2017-03-28 17:32:22 PDT
(In reply to Ryosuke Niwa from comment #2)
> Comment on attachment 305671 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=305671&action=review
> 
> > PerformanceTests/ChangeLog:7
> > +
> 
> Thanks for contributing the patch but please describe your change and add
> inline comments.
> r- due to lack of change log comments.

Thanks for the quick review.  Added change description.

For inline comments, I tried to match the style of the existing code.  Are there specific parts you think could benefit from additional comments?
Comment 5 Ryosuke Niwa 2017-03-30 01:11:18 PDT
Comment on attachment 305682 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305682&action=review

Useful inline comments would explain why you're making each code change, and how it impacts the rest of the codebase.

> PerformanceTests/MotionMark/tests/3d/resources/webgl.js:143
> -                this._startTime = Stage.dateCounterValue(1000);
> -            var elapsedTime = Stage.dateCounterValue(1000) - this._startTime;
> +                this._startTime = this.timestampCounterValue(1000);
> +            var elapsedTime = this.timestampCounterValue(1000) - this._startTime;

Why are we replacing Stage.dateCounterValue with this.timestampCounterValue?
What's the significance of it? e.g. does Stage.dateCounterValue use Date.now() and this.timestampCounterValue doesn't?
None of that is clear from your main change log description.

> PerformanceTests/MotionMark/tests/master/resources/canvas-tests.js:19
> +        this._stage = stage;

A useful inline comment here would be explaining why we need to store "stage" as an instance variable.

> PerformanceTests/MotionMark/tests/resources/main.js:654
> +    set timestamp(stamp)
> +    {
> +        this._currentTimestamp = stamp;
> +    },
> +
> +    get timestamp()
> +    {
> +        return this._currentTimestamp;
> +    },
> +

What are these getters and setters used for? Who is getting the value?

> PerformanceTests/MotionMark/tests/resources/main.js:676
> +    rotatingColor: function(cycleLengthMs, saturation, lightness)
> +    {

Why are you moving these methods here?
That should be explained in the change log.
Comment 6 Maciej Stachowiak 2020-05-30 19:10:22 PDT
Comment on attachment 305682 [details]
Patch

Seems like a good idea. Unfortunately, the patch no longer applies as-is.