-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up the classes that handle run results, and correctly import JSON files with multiple runs #77
Open
smfr
wants to merge
5
commits into
WebKit:main
Choose a base branch
from
smfr:handle-multiple-iteration-data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Clean up the classes that handle run results, and correctly import JSON files with multiple runs #77
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4cbe356
Move ResultsDashboard and ResultTable to a new file.
smfr 2bec247
Add unit tests for data import, and minor fixes.
smfr 3a9e3f2
Rename ResultsDashboard to ScoreCalculator
smfr 55a6bcc
Make a RunData class
smfr 13dce51
Import all runs from a benchmark JSON file
smfr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,10 +152,10 @@ class DebugSectionsManager extends SectionsManager { | |
document.querySelector("#" + sectionIdentifier + " h1").textContent = title; | ||
} | ||
|
||
populateTable(tableIdentifier, headers, dashboard) | ||
populateTable(tableIdentifier, headers, scoreCalculator) | ||
{ | ||
var table = new DeveloperResultsTable(document.getElementById(tableIdentifier), headers); | ||
table.showIterations(dashboard); | ||
table.showIterations(scoreCalculator); | ||
} | ||
} | ||
|
||
|
@@ -534,7 +534,7 @@ class DebugBenchmarkController extends BenchmarkController { | |
this.updateUIStrings(); | ||
this.graphController = new GraphController; | ||
|
||
document.forms["benchmark-options"].addEventListener("change", () => { this.onBenchmarkOptionsChanged() }, true); | ||
document.forms["benchmark-options"].addEventListener("change", (event) => { this.onBenchmarkOptionsChanged(event) }, true); | ||
document.forms["graph-type"].addEventListener("change", () => { this.graphController.onGraphTypeChanged() }, true); | ||
document.forms["time-graph-options"].addEventListener("change", () => { this.graphController.onTimeGraphOptionsChanged() }, true); | ||
document.forms["complexity-graph-options"].addEventListener("change", () => { this.graphController.onComplexityGraphOptionsChanged() }, true); | ||
|
@@ -593,13 +593,16 @@ class DebugBenchmarkController extends BenchmarkController { | |
var reader = new FileReader(); | ||
reader.filename = file.name; | ||
reader.onload = (e) => { | ||
var run = JSON.parse(e.target.result); | ||
if (run.debugOutput instanceof Array) | ||
run = run.debugOutput[0]; | ||
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.migrateImportedData(run); | ||
this.ensureRunnerClient([ ], { }); | ||
this.runnerClient.results = new ResultsDashboard(run.version, run.options, run.data); | ||
this.runnerClient.scoreCalculator = new ScoreCalculator(results); | ||
this.showResults(); | ||
}; | ||
|
||
|
@@ -608,22 +611,6 @@ class DebugBenchmarkController extends BenchmarkController { | |
}, false); | ||
} | ||
|
||
migrateImportedData(runData) | ||
{ | ||
if (!("version" in runData)) | ||
runData.version = "1.0"; | ||
|
||
if (!("frame-rate" in runData.options)) { | ||
runData.options["frame-rate"] = 60; | ||
console.log("No frame-rate data; assuming 60fps") | ||
} | ||
|
||
if (!("system-frame-rate" in runData.options)) { | ||
runData.options["system-frame-rate"] = 60; | ||
console.log("No system-frame-rate data; assuming 60fps") | ||
} | ||
} | ||
|
||
frameRateDeterminationComplete(targetFrameRate) | ||
{ | ||
let frameRateLabelContent = Strings.text.usingFrameRate.replace("%s", targetFrameRate); | ||
|
@@ -704,38 +691,38 @@ class DebugBenchmarkController extends BenchmarkController { | |
this.addedKeyEvent = true; | ||
} | ||
|
||
var dashboard = this.runnerClient.results; | ||
if (dashboard.options["controller"] == "ramp") | ||
var scoreCalculator = this.runnerClient.scoreCalculator; | ||
if (scoreCalculator.options["controller"] == "ramp") | ||
Headers.details[3].disabled = true; | ||
else { | ||
Headers.details[1].disabled = true; | ||
Headers.details[4].disabled = true; | ||
} | ||
|
||
if (dashboard.options[Strings.json.configuration]) { | ||
if (scoreCalculator.options[Strings.json.configuration]) { | ||
document.body.classList.remove("small", "medium", "large"); | ||
document.body.classList.add(dashboard.options[Strings.json.configuration]); | ||
document.body.classList.add(scoreCalculator.options[Strings.json.configuration]); | ||
} | ||
|
||
var score = dashboard.score; | ||
var confidence = ((dashboard.scoreLowerBound / score - 1) * 100).toFixed(2) + | ||
"% / +" + ((dashboard.scoreUpperBound / score - 1) * 100).toFixed(2) + "%"; | ||
var fps = dashboard._systemFrameRate; | ||
sectionsManager.setSectionVersion("results", dashboard.version); | ||
var score = scoreCalculator.score; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not |
||
var confidence = ((scoreCalculator.scoreLowerBound / score - 1) * 100).toFixed(2) + | ||
"% / +" + ((scoreCalculator.scoreUpperBound / score - 1) * 100).toFixed(2) + "%"; | ||
var fps = scoreCalculator._systemFrameRate; | ||
sectionsManager.setSectionVersion("results", scoreCalculator.version); | ||
sectionsManager.setSectionScore("results", score.toFixed(2), confidence, fps); | ||
sectionsManager.populateTable("results-header", Headers.testName, dashboard); | ||
sectionsManager.populateTable("results-score", Headers.score, dashboard); | ||
sectionsManager.populateTable("results-data", Headers.details, dashboard); | ||
sectionsManager.populateTable("results-header", Headers.testName, scoreCalculator); | ||
sectionsManager.populateTable("results-score", Headers.score, scoreCalculator); | ||
sectionsManager.populateTable("results-data", Headers.details, scoreCalculator); | ||
sectionsManager.showSection("results", true); | ||
|
||
suitesManager.updateLocalStorageFromJSON(dashboard.results[0]); | ||
suitesManager.updateLocalStorageFromJSON(scoreCalculator.results[0]); | ||
} | ||
|
||
showTestGraph(testName, testResult, testData) | ||
{ | ||
sectionsManager.setSectionHeader("test-graph", testName); | ||
sectionsManager.showSection("test-graph", true); | ||
this.graphController.updateGraphData(testResult, testData, this.runnerClient.results.options); | ||
this.graphController.updateGraphData(testResult, testData, this.runnerClient.scoreCalculator.options); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let?