Skip to content

Commit da95272

Browse files
committed
The first frame of each ramp has an erroneously long frame duration
`RampController.didFinishInterval()` is called before `Controller.update()` calls `this._sampler.record()`. This results in _rampStartIndex being off by one, pointing to the frame before start of the ramp, which in turn causes us to compute a long frame duration for this frame. This long frame feeds into the ramp controller regression computation, throwing it off slightly, and adding noise. Fix by having `Controller.update()` call `_sampler.record()` before it calls `didFinishInterval()`, which requires calling `_sampler.record()` in each of the three code paths.
1 parent b9253e7 commit da95272

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

MotionMark/tests/resources/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ Controller = Utilities.createClass(
165165
this._frameLengthEstimator.sample(lastFrameLength);
166166
frameLengthEstimate = this._frameLengthEstimator.estimate;
167167
}
168+
this._sampler.record(timestamp, stage.complexity(), frameLengthEstimate);
168169
} else {
169170
this.registerFrameTime(lastFrameLength);
170171
if (this.intervalHasConcluded(timestamp)) {
@@ -174,13 +175,15 @@ Controller = Utilities.createClass(
174175
this._frameLengthEstimator.sample(intervalAverageFrameLength);
175176
frameLengthEstimate = this._frameLengthEstimator.estimate;
176177
}
178+
this._sampler.record(timestamp, stage.complexity(), frameLengthEstimate);
179+
177180
didFinishInterval = true;
178181
this.didFinishInterval(timestamp, stage, intervalAverageFrameLength);
179182
this._frameLengthEstimator.reset();
180-
}
183+
} else
184+
this._sampler.record(timestamp, stage.complexity(), frameLengthEstimate);
181185
}
182186

183-
this._sampler.record(timestamp, stage.complexity(), frameLengthEstimate);
184187
this.tune(timestamp, stage, lastFrameLength, didFinishInterval, intervalAverageFrameLength);
185188
},
186189

0 commit comments

Comments
 (0)