Title: [192107] trunk/PerformanceTests
- Revision
- 192107
- Author
- [email protected]
- Date
- 2015-11-06 09:55:08 -0800 (Fri, 06 Nov 2015)
Log Message
Initialize the graphics benchmark's Kalman filter with estimated 60 FPS
https://bugs.webkit.org/show_bug.cgi?id=150965
Patch by Said Abou-Hallawa <[email protected]> on 2015-11-06
Reviewed by Darin Adler.
This should give the benchmark more accurate reading at warmup time. And
hence we can safely reduce the test running time to be 10 seconds.
* Animometer/runner/animometer.html:
Add "defer" back when loading resources/animometer.js since this script
depends on many other scripts and we need to wait till the page is parsed.
Also change the default test interval to be 10 seconds.
* Animometer/runner/resources/graph.js:
(graph): Make the test results curves smoother.
* Animometer/tests/resources/main.js:
(Animator): Initialize the Kalman filter with 60 FPS which should be true
if the test page is empty.
(Animator.prototype.animate):
* Animometer/tests/resources/math.js:
(KalmanEstimator): Fix the initial value of _vecX_est.
_vecX_est[0] = current FPS (= 60FPS when the test page is empty)
_vecX_est[1] = first time derivative of FPS (=0; FPS has been constant).
_vecX_est[2] = second time derivative of FPS (=0; since _vecX_est[1]=0).
(KalmanEstimator.prototype.estimate): Add some comments.
Modified Paths
Diff
Modified: trunk/PerformanceTests/Animometer/runner/animometer.html (192106 => 192107)
--- trunk/PerformanceTests/Animometer/runner/animometer.html 2015-11-06 16:58:31 UTC (rev 192106)
+++ trunk/PerformanceTests/Animometer/runner/animometer.html 2015-11-06 17:55:08 UTC (rev 192107)
@@ -7,7 +7,7 @@
<script src=""
<script src=""
<script src=""
- <script src=""
+ <script src="" defer></script>
<script src=""
<script src=""
</head>
@@ -27,7 +27,7 @@
</suites>
<options>
<h2>Options:</h2>
- <label>Test interval: <input id="test-interval" type="number" value="30"> seconds</label><br>
+ <label>Test interval: <input id="test-interval" type="number" value="10"> seconds</label><br>
<label>Frame rate: <input id="frame-rate" type="number" value="50"> fps</label><br>
<label><input id="estimated-frame-rate" type="checkbox" checked> Estimated Frame Rate</label><br>
<label><input id="fix-test-complexity" type="checkbox"> Fix test complexity after warmup</label><br>
Modified: trunk/PerformanceTests/Animometer/runner/resources/graph.js (192106 => 192107)
--- trunk/PerformanceTests/Animometer/runner/resources/graph.js 2015-11-06 16:58:31 UTC (rev 192106)
+++ trunk/PerformanceTests/Animometer/runner/resources/graph.js 2015-11-06 17:55:08 UTC (rev 192107)
@@ -30,10 +30,12 @@
.orient("right");
var lineLeft = d3.svg.line()
+ .interpolate("basis")
.x(function(d) { return x(d.timeOffset); })
.y(function(d) { return yLeft(d.values[0]); });
var lineRight = d3.svg.line()
+ .interpolate("basis")
.x(function(d) { return x(d.timeOffset); })
.y(function(d) { return yRight(d.values[1]); });
Modified: trunk/PerformanceTests/Animometer/tests/resources/main.js (192106 => 192107)
--- trunk/PerformanceTests/Animometer/tests/resources/main.js 2015-11-06 16:58:31 UTC (rev 192106)
+++ trunk/PerformanceTests/Animometer/tests/resources/main.js 2015-11-06 17:55:08 UTC (rev 192107)
@@ -67,7 +67,7 @@
this._measureFrameCount = 3;
this._referenceTime = 0;
this._currentTimeOffset = 0;
- this._estimator = new KalmanEstimator();
+ this._estimator = new KalmanEstimator(60);
}
Animator.prototype =
@@ -110,7 +110,7 @@
// Use Kalman filter to get a more non-fluctuating frame rate.
if (this._benchmark.options["estimated-frame-rate"])
- currentFrameRate = this._estimator.estimate(measureTimeDelta, currentFrameRate);
+ currentFrameRate = this._estimator.estimate(currentFrameRate);
// Adjust the test to reach the desired FPS.
var result = this._benchmark.update(this._currentTimeOffset, this.timeDelta(), currentFrameRate);
Modified: trunk/PerformanceTests/Animometer/tests/resources/math.js (192106 => 192107)
--- trunk/PerformanceTests/Animometer/tests/resources/math.js 2015-11-06 16:58:31 UTC (rev 192106)
+++ trunk/PerformanceTests/Animometer/tests/resources/math.js 2015-11-06 17:55:08 UTC (rev 192107)
@@ -233,42 +233,55 @@
}
}
-function KalmanEstimator()
+function KalmanEstimator(initX)
{
+ // Initialize state transition matrix
this._matA = Matrix3.identity();
+ this._matA[Matrix3.pos(0, 2)] = 1;
+ // Initialize measurement matrix
this._vecH = Vector3.zeros();
this._vecH[0] = 1;
this._matQ = Matrix3.identity();
this._R = 1000;
- this._vecX_est = Vector3.ones();
+ // Initial state conditions
+ this._vecX_est = Vector3.zeros();
+ this._vecX_est[0] = initX;
this._matP_est = Matrix3.zeros();
}
KalmanEstimator.prototype =
{
- estimate: function(timeDelta, current)
+ estimate: function(current)
{
- // Update the transition matrix.
- this._matA[Matrix3.pos(0, 2)] = 1;
-
- // Predicted state and covariance.
+ // Project the state ahead
+ // X_prd(k) = A * X_est(k-1)
var vecX_prd = Matrix3.multiplyVector3(this._matA, this._vecX_est);
+
+ // Project the error covariance ahead
+ // P_prd(k) = A * P_est(k-1) * A' + Q
var matP_prd = Matrix3.add(Matrix3.multiplyMatrix3(Matrix3.multiplyMatrix3(this._matA, this._matP_est), Matrix3.transpose(this._matA)), this._matQ);
- // Estimation.
+ // Compute Kalman gain
+ // B = H * P_prd(k)';
+ // S = B * H' + R;
+ // K(k) = (S \ B)';
var vecB = Vector3.multiplyMatrix3(this._vecH, Matrix3.transpose(matP_prd));
var S = Vector3.multiplyVector3(vecB, this._vecH) + this._R;
-
var vecGain = Vector3.scale(1/S, vecB);
- // Estimated state and covariance.
+ // Update the estimate via z(k)
+ // X_est(k) = x_prd + K(k) * (z(k) - H * X_prd(k));
this._vecX_est = Vector3.add(vecX_prd, Vector3.scale(current - Vector3.multiplyVector3(this._vecH, vecX_prd), vecGain));
+
+ // Update the error covariance
+ // P_est(k) = P_prd(k) - K(k) * H * P_prd(k);
this._matP_est = Matrix3.subtract(matP_prd, Matrix3.scale(Vector3.multiplyVector3(vecGain, this._vecH), matP_prd));
// Compute the estimated measurement.
+ // y = H * X_est(k);
return Vector3.multiplyVector3(this._vecH, this._vecX_est);
}
}
Modified: trunk/PerformanceTests/ChangeLog (192106 => 192107)
--- trunk/PerformanceTests/ChangeLog 2015-11-06 16:58:31 UTC (rev 192106)
+++ trunk/PerformanceTests/ChangeLog 2015-11-06 17:55:08 UTC (rev 192107)
@@ -1,3 +1,33 @@
+2015-11-06 Said Abou-Hallawa <[email protected]>
+
+ Initialize the graphics benchmark's Kalman filter with estimated 60 FPS
+ https://bugs.webkit.org/show_bug.cgi?id=150965
+
+ Reviewed by Darin Adler.
+
+ This should give the benchmark more accurate reading at warmup time. And
+ hence we can safely reduce the test running time to be 10 seconds.
+
+ * Animometer/runner/animometer.html:
+ Add "defer" back when loading resources/animometer.js since this script
+ depends on many other scripts and we need to wait till the page is parsed.
+ Also change the default test interval to be 10 seconds.
+
+ * Animometer/runner/resources/graph.js:
+ (graph): Make the test results curves smoother.
+
+ * Animometer/tests/resources/main.js:
+ (Animator): Initialize the Kalman filter with 60 FPS which should be true
+ if the test page is empty.
+
+ (Animator.prototype.animate):
+ * Animometer/tests/resources/math.js:
+ (KalmanEstimator): Fix the initial value of _vecX_est.
+ _vecX_est[0] = current FPS (= 60FPS when the test page is empty)
+ _vecX_est[1] = first time derivative of FPS (=0; FPS has been constant).
+ _vecX_est[2] = second time derivative of FPS (=0; since _vecX_est[1]=0).
+ (KalmanEstimator.prototype.estimate): Add some comments.
+
2015-11-04 Said Abou-Hallawa <[email protected]>
Remove "defer" from the scripts' references in the graphics benchmark home page
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes