Skip to content

Commit c2f7f50

Browse files
committed
Rename ResultsDashboard to ScoreCalculator
`BenchmarkRunnerClient.results` becomes `BenchmarkRunnerClient.scoreCalculator`. Add a public getter for `targetFrameRate`.
1 parent 559aee7 commit c2f7f50

File tree

4 files changed

+54
-39
lines changed

4 files changed

+54
-39
lines changed

MotionMark/resources/debug-runner/debug-runner.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ class DebugSectionsManager extends SectionsManager {
152152
document.querySelector("#" + sectionIdentifier + " h1").textContent = title;
153153
}
154154

155-
populateTable(tableIdentifier, headers, dashboard)
155+
populateTable(tableIdentifier, headers, scoreCalculator)
156156
{
157157
var table = new DeveloperResultsTable(document.getElementById(tableIdentifier), headers);
158-
table.showIterations(dashboard);
158+
table.showIterations(scoreCalculator);
159159
}
160160
}
161161

@@ -599,7 +599,7 @@ class DebugBenchmarkController extends BenchmarkController {
599599

600600
this.migrateImportedData(run);
601601
this.ensureRunnerClient([ ], { });
602-
this.runnerClient.results = new ResultsDashboard(run.version, run.options, run.data);
602+
this.runnerClient.scoreCalculator = new ScoreCalculator(run.version, run.options, run.data);
603603
this.showResults();
604604
};
605605

@@ -704,38 +704,38 @@ class DebugBenchmarkController extends BenchmarkController {
704704
this.addedKeyEvent = true;
705705
}
706706

707-
var dashboard = this.runnerClient.results;
708-
if (dashboard.options["controller"] == "ramp")
707+
var scoreCalculator = this.runnerClient.scoreCalculator;
708+
if (scoreCalculator.options["controller"] == "ramp")
709709
Headers.details[3].disabled = true;
710710
else {
711711
Headers.details[1].disabled = true;
712712
Headers.details[4].disabled = true;
713713
}
714714

715-
if (dashboard.options[Strings.json.configuration]) {
715+
if (scoreCalculator.options[Strings.json.configuration]) {
716716
document.body.classList.remove("small", "medium", "large");
717-
document.body.classList.add(dashboard.options[Strings.json.configuration]);
717+
document.body.classList.add(scoreCalculator.options[Strings.json.configuration]);
718718
}
719719

720-
var score = dashboard.score;
721-
var confidence = ((dashboard.scoreLowerBound / score - 1) * 100).toFixed(2) +
722-
"% / +" + ((dashboard.scoreUpperBound / score - 1) * 100).toFixed(2) + "%";
723-
var fps = dashboard._systemFrameRate;
724-
sectionsManager.setSectionVersion("results", dashboard.version);
720+
var score = scoreCalculator.score;
721+
var confidence = ((scoreCalculator.scoreLowerBound / score - 1) * 100).toFixed(2) +
722+
"% / +" + ((scoreCalculator.scoreUpperBound / score - 1) * 100).toFixed(2) + "%";
723+
var fps = scoreCalculator._systemFrameRate;
724+
sectionsManager.setSectionVersion("results", scoreCalculator.version);
725725
sectionsManager.setSectionScore("results", score.toFixed(2), confidence, fps);
726-
sectionsManager.populateTable("results-header", Headers.testName, dashboard);
727-
sectionsManager.populateTable("results-score", Headers.score, dashboard);
728-
sectionsManager.populateTable("results-data", Headers.details, dashboard);
726+
sectionsManager.populateTable("results-header", Headers.testName, scoreCalculator);
727+
sectionsManager.populateTable("results-score", Headers.score, scoreCalculator);
728+
sectionsManager.populateTable("results-data", Headers.details, scoreCalculator);
729729
sectionsManager.showSection("results", true);
730730

731-
suitesManager.updateLocalStorageFromJSON(dashboard.results[0]);
731+
suitesManager.updateLocalStorageFromJSON(scoreCalculator.results[0]);
732732
}
733733

734734
showTestGraph(testName, testResult, testData)
735735
{
736736
sectionsManager.setSectionHeader("test-graph", testName);
737737
sectionsManager.showSection("test-graph", true);
738-
this.graphController.updateGraphData(testResult, testData, this.runnerClient.results.options);
738+
this.graphController.updateGraphData(testResult, testData, this.runnerClient.scoreCalculator.options);
739739
}
740740
}
741741

MotionMark/resources/runner/motionmark.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,29 @@ class BenchmarkRunnerClient {
3333
this.options = options;
3434
}
3535

36+
get scoreCalculator()
37+
{
38+
return this._scoreCalculator;
39+
}
40+
41+
set scoreCalculator(calculator)
42+
{
43+
this._scoreCalculator = calculator;
44+
}
45+
3646
willStartFirstIteration()
3747
{
38-
this.results = new ResultsDashboard(Strings.version, this.options);
48+
this.scoreCalculator = new ScoreCalculator(Strings.version, this.options);
3949
}
4050

4151
didRunSuites(suitesSamplers)
4252
{
43-
this.results.push(suitesSamplers);
53+
this._scoreCalculator.push(suitesSamplers);
4454
}
4555

4656
didRunTest(testData)
4757
{
48-
this.results.calculateScore(testData);
58+
this._scoreCalculator.calculateScore(testData);
4959
}
5060

5161
didFinishLastIteration()
@@ -89,10 +99,10 @@ class SectionsManager {
8999
document.querySelector("#" + sectionIdentifier + " .confidence").textContent = confidence;
90100
}
91101

92-
populateTable(tableIdentifier, headers, dashboard)
102+
populateTable(tableIdentifier, headers, scoreCalculator)
93103
{
94104
var table = new ResultsTable(document.getElementById(tableIdentifier), headers);
95-
table.showIterations(dashboard);
105+
table.showIterations(scoreCalculator);
96106
}
97107
}
98108

@@ -299,15 +309,15 @@ class BenchmarkController {
299309
this.addedKeyEvent = true;
300310
}
301311

302-
const dashboard = this.runnerClient.results;
303-
const score = dashboard.score;
304-
const confidence = "±" + (Statistics.largestDeviationPercentage(dashboard.scoreLowerBound, score, dashboard.scoreUpperBound) * 100).toFixed(2) + "%";
305-
const fps = dashboard._targetFrameRate;
306-
sectionsManager.setSectionVersion("results", dashboard.version);
312+
const scoreCalculator = this.runnerClient.scoreCalculator;
313+
const score = scoreCalculator.score;
314+
const confidence = "±" + (Statistics.largestDeviationPercentage(scoreCalculator.scoreLowerBound, score, scoreCalculator.scoreUpperBound) * 100).toFixed(2) + "%";
315+
const fps = scoreCalculator.targetFrameRate;
316+
sectionsManager.setSectionVersion("results", scoreCalculator.version);
307317
sectionsManager.setSectionScore("results", score.toFixed(2), confidence, fps);
308-
sectionsManager.populateTable("results-header", Headers.testName, dashboard);
309-
sectionsManager.populateTable("results-score", Headers.score, dashboard);
310-
sectionsManager.populateTable("results-data", Headers.details, dashboard);
318+
sectionsManager.populateTable("results-header", Headers.testName, scoreCalculator);
319+
sectionsManager.populateTable("results-score", Headers.score, scoreCalculator);
320+
sectionsManager.populateTable("results-data", Headers.details, scoreCalculator);
311321
sectionsManager.showSection("results", true);
312322
}
313323

@@ -352,9 +362,9 @@ class BenchmarkController {
352362
data.textContent = "Please wait...";
353363
setTimeout(() => {
354364
var output = {
355-
version: this.runnerClient.results.version,
356-
options: this.runnerClient.results.options,
357-
data: this.runnerClient.results.data
365+
version: this.runnerClient.scoreCalculator.version,
366+
options: this.runnerClient.scoreCalculator.options,
367+
data: this.runnerClient.scoreCalculator.data
358368
};
359369
data.textContent = JSON.stringify(output, (key, value) => {
360370
if (typeof value === 'number')

MotionMark/resources/runner/results.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
2525

26-
class ResultsDashboard {
26+
class ScoreCalculator {
2727
constructor(version, options, testData)
2828
{
2929
this._iterationsSamplers = [];
@@ -42,6 +42,11 @@ class ResultsDashboard {
4242
this._processData();
4343
}
4444
}
45+
46+
get targetFrameRate()
47+
{
48+
return this._targetFrameRate;
49+
}
4550

4651
push(suitesSamplers)
4752
{
@@ -394,15 +399,15 @@ class ResultsTable {
394399
}
395400
}
396401

397-
showIterations(dashboard)
402+
showIterations(scoreCalculator)
398403
{
399404
this.clear();
400405
this._addHeader();
401406
this._addBody();
402407

403-
var iterationsResults = dashboard.results;
408+
var iterationsResults = scoreCalculator.results;
404409
iterationsResults.forEach(function(iterationResult, index) {
405-
this._addIteration(iterationResult, dashboard.data[index], dashboard.options);
410+
this._addIteration(iterationResult, scoreCalculator.data[index], scoreCalculator.options);
406411
}, this);
407412
}
408413
}

MotionMark/unit-tests/tests/test-data-import.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ describe('Data Import', function() {
4646
// Make the results analysis faster.
4747
this.json.options[Strings.json.bootstrapIterations] = 10;
4848

49-
const dashboard = new ResultsDashboard(this.json.version, this.json.options, this.json.data);
50-
this.results = dashboard.results;
49+
const calculator = new ScoreCalculator(this.json.version, this.json.options, this.json.data);
50+
this.results = calculator.results;
5151
expect(this.results instanceof Array).to.be(true);
5252
});
5353

0 commit comments

Comments
 (0)