From cdda0518ddef026254c8a9f85e8f71e1296b5e16 Mon Sep 17 00:00:00 2001 From: Sunny Sachanandani Date: Wed, 6 Aug 2025 13:29:19 -0700 Subject: [PATCH 1/2] Add button and shortcut to download results JSON --- MotionMark/developer.html | 1 + MotionMark/resources/runner/motionmark.js | 37 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/MotionMark/developer.html b/MotionMark/developer.html index b2de742..0239a83 100644 --- a/MotionMark/developer.html +++ b/MotionMark/developer.html @@ -158,6 +158,7 @@

MotionMark score

'j': Show JSON results
+ 'd': Download JSON results
's': Select various results for copy/paste (use repeatedly to cycle)

diff --git a/MotionMark/resources/runner/motionmark.js b/MotionMark/resources/runner/motionmark.js index 193e212..f0ca68d 100644 --- a/MotionMark/resources/runner/motionmark.js +++ b/MotionMark/resources/runner/motionmark.js @@ -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; @@ -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) From 4a56c758a72d46bf6b62aa0dfdda77ea70e30014 Mon Sep 17 00:00:00 2001 From: Sunny Sachanandani Date: Tue, 3 Mar 2026 15:22:17 -0800 Subject: [PATCH 2/2] Add a "Load results" button to upload results JSON --- MotionMark/developer.html | 7 ++- .../resources/debug-runner/debug-runner.js | 44 +++++++++++-------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/MotionMark/developer.html b/MotionMark/developer.html index 0239a83..5107821 100644 --- a/MotionMark/developer.html +++ b/MotionMark/developer.html @@ -59,7 +59,12 @@

version

Suites:

    -
    Drop results here
    +
    + Drop results here + + +

    Options:

    diff --git a/MotionMark/resources/debug-runner/debug-runner.js b/MotionMark/resources/debug-runner/debug-runner.js index 085f4d3..ef5e72d 100644 --- a/MotionMark/resources/debug-runner/debug-runner.js +++ b/MotionMark/resources/debug-runner/debug-runner.js @@ -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(); + 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)