Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion MotionMark/developer.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ <h2>version <span class="version"></span></h2>
<div id="suites">
<h2>Suites:</h2>
<ul class="tree"></ul>
<div><span id="drop-target">Drop results here</span></div>
<div>
<span id="drop-target">Drop results here</span>
<button id="load-results-button" onclick="benchmarkController.loadResults()">Load results…</button>
<input type="file" id="load-results-input" style="display: none;"
onchange="benchmarkController.handleResultsFile(this)">
</div>
</div>
<div id="options">
<h2>Options:</h2>
Expand Down Expand Up @@ -158,6 +163,7 @@ <h1>MotionMark score</h1>
<button onclick="benchmarkController.restartBenchmark()">Test Again</button>
<p>
'j': Show JSON results<br/>
'd': Download JSON results<br/>
's': Select various results for copy/paste (use repeatedly to cycle)
</p>
</div>
Expand Down
44 changes: 25 additions & 19 deletions MotionMark/resources/debug-runner/debug-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,28 +587,34 @@ class DebugBenchmarkController extends BenchmarkController {
}

dropTarget.textContent = 'Processing…';
this.handleResultsFile(e.dataTransfer.files[0]);
}, false);
}

var file = e.dataTransfer.files[0];

var reader = new FileReader();
reader.filename = file.name;
reader.onload = (e) => {
const data = JSON.parse(e.target.result);

let results;
if (data['debugOutput'] instanceof Array)
results = RunData.resultsDataFromBenchmarkRunnerData(data['debugOutput']);
else
results = RunData.resultsDataFromSingleRunData(data);
loadResults() {
document.getElementById("load-results-input").click();
}

this.ensureRunnerClient([ ], { });
this.runnerClient.scoreCalculator = new ScoreCalculator(results);
this.showResults();
};
handleResultsFile(fileOrInput) {
var file = fileOrInput instanceof File ? fileOrInput : fileOrInput.files[0];
if (!file)
return;

reader.readAsText(file);
document.title = "File: " + reader.filename;
}, false);
var reader = new FileReader();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

reader.filename = file.name;
reader.onload = (e) => {
const data = JSON.parse(e.target.result);
let results;
if (data['debugOutput'] instanceof Array)
results = RunData.resultsDataFromBenchmarkRunnerData(data['debugOutput']);
else
results = RunData.resultsDataFromSingleRunData(data);
this.ensureRunnerClient([], {});
this.runnerClient.scoreCalculator = new ScoreCalculator(results);
this.showResults();
};
reader.readAsText(file);
document.title = "File: " + reader.filename;
}

frameRateDeterminationComplete(targetFrameRate)
Expand Down
37 changes: 34 additions & 3 deletions MotionMark/resources/runner/motionmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ class BenchmarkController {
case 106: // j
benchmarkController.showDebugInfo();
break;
case 100: // d
benchmarkController.downloadDebugInfo();
break;
case 115: // s
benchmarkController.selectResults(event.target);
break;
Expand Down Expand Up @@ -380,11 +383,39 @@ class BenchmarkController {
selection.addRange(range);
};

var button = Utilities.createElement("button", {}, container);
button.textContent = "Done";
button.onclick = () => {
var doneButton = Utilities.createElement("button", {}, container);
doneButton.textContent = "Done";
doneButton.onclick = () => {
this.hideDebugInfo();
};

var downloadButton = Utilities.createElement("button", {}, container);
downloadButton.textContent = "Download";
downloadButton.onclick = () => {
this.downloadDebugInfo();
};
}

downloadDebugInfo()
{
var output = {
version: this.runnerClient.scoreCalculator.version,
options: this.runnerClient.scoreCalculator.options,
data: this.runnerClient.scoreCalculator.data
};
var json = JSON.stringify(output, (key, value) => {
if (typeof value === 'number')
return Utilities.toFixedNumber(value, 3);
return value;
}, 1);
var blob = new Blob([json], { type: "application/json" });
var url = URL.createObjectURL(blob);

var a = document.createElement('a');
a.href = url;
a.download = 'motionmark-results.json';
a.click();
URL.revokeObjectURL(url);
}

selectResults(target)
Expand Down