Initialize the graphics benchmark's Kalman filter with estimated 60 FPS
[WebKit-https.git] / PerformanceTests / Animometer / tests / resources / main.js
index ea77ceb9397f77a29f7f8dce505300bceb71920d..76873349678508fc376f0d88401d47420b81ec54 100644 (file)
@@ -67,7 +67,7 @@ function Animator(benchmark)
     this._measureFrameCount = 3; 
     this._referenceTime = 0;
     this._currentTimeOffset = 0;
-    this._estimator = new KalmanEstimator();
+    this._estimator = new KalmanEstimator(60);
 }
 
 Animator.prototype =
@@ -109,8 +109,8 @@ Animator.prototype =
         var currentFrameRate = Math.floor(1000 / (measureTimeDelta / this._measureFrameCount));
          
         // Use Kalman filter to get a more non-fluctuating frame rate.
-        if (this._benchmark.options.estimatedFrameRate)
-            currentFrameRate = this._estimator.estimate(measureTimeDelta, currentFrameRate);
+        if (this._benchmark.options["estimated-frame-rate"])
+            currentFrameRate = this._estimator.estimate(currentFrameRate);
         
         // Adjust the test to reach the desired FPS.
         var result = this._benchmark.update(this._currentTimeOffset, this.timeDelta(), currentFrameRate);
@@ -146,9 +146,9 @@ function Benchmark(options)
     var lowValue = -parseInt(this._options["addLimit"]) || 1;
     var highValue = parseInt(this._options["removeLimit"]) || 1;
     
-    this._controller = new PIDController(gain, options.frameRate, lowValue, highValue);
+    this._controller = new PIDController(gain, options["frame-rate"], lowValue, highValue);
     this._sampler = new Sampler(2);
-    this._state = new BenchmarkState(this.options.testInterval);    
+    this._state = new BenchmarkState(this.options["test-interval"] * 1000);
 }
 
 Benchmark.prototype =
@@ -179,7 +179,11 @@ Benchmark.prototype =
         }
 
         var tuneValue = 0;
-        if (!(this._isSampling && this.options.fixTestComplexity)) {
+        if (this.options["complexity"] && !this.options["adaptive-test"]) {
+            // this.tune(0) returns the current complexity of the test.
+            tuneValue = this.options["complexity"] - this.tune(0);
+        }
+        else if (!(this._isSampling && this.options["fix-test-complexity"])) {
             // The relationship between frameRate and test complexity is inverse-proportional so we
             // need to use the negative of PIDController.tune() to change the complexity of the test.
             tuneValue = -this._controller.tune(currentFrameRate, timeDelta / 1000);
@@ -237,7 +241,9 @@ window.addEventListener("load", function()
 // This function is called from the suite controller run-callback when running the benchmark runner.
 window.runBenchmark = function(suite, test, options, recordTable, progressBar)
 {
-    var mergedOptions = Utilities.mergeObjects(options, Utilities.parseParameters());
-    window.benchmark = window.benchmarkClient.create(suite, test, mergedOptions, recordTable, progressBar);
+    var benchmarkOptions = { complexity: test.complexity };
+    benchmarkOptions = Utilities.mergeObjects(benchmarkOptions, options);
+    benchmarkOptions = Utilities.mergeObjects(benchmarkOptions, Utilities.parseParameters());
+    window.benchmark = window.benchmarkClient.create(suite, test, benchmarkOptions, recordTable, progressBar);
     return window.benchmark.run();
 }