JS2 should print scores for different categories
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 May 2019 20:36:40 +0000 (20:36 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 May 2019 20:36:40 +0000 (20:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197605

Reviewed by Yusuke Suzuki.

* JetStream2/JetStreamDriver.js:
(displayCategoryScores):
(isInBrowser.document.onkeydown):
(Driver.prototype.async.start):
(Driver.prototype.async.reportScoreToRunBenchmarkRunner):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244973 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/JetStream2/JetStreamDriver.js

index 3bbf37a..4ee19b6 100644 (file)
@@ -1,3 +1,16 @@
+2019-05-06  Saam Barati  <sbarati@apple.com>
+
+        JS2 should print scores for different categories
+        https://bugs.webkit.org/show_bug.cgi?id=197605
+
+        Reviewed by Yusuke Suzuki.
+
+        * JetStream2/JetStreamDriver.js:
+        (displayCategoryScores):
+        (isInBrowser.document.onkeydown):
+        (Driver.prototype.async.start):
+        (Driver.prototype.async.reportScoreToRunBenchmarkRunner):
+
 2019-04-16  Jon Lee  <jonlee@apple.com>
 
         [MotionMark] The text "kkkj" is causing Firefox console warning: `unreachable code after return statement`
 2019-04-16  Jon Lee  <jonlee@apple.com>
 
         [MotionMark] The text "kkkj" is causing Firefox console warning: `unreachable code after return statement`
index c228f0c..221d200 100644 (file)
@@ -41,6 +41,31 @@ this.currentReject = null;
 const defaultIterationCount = 120;
 const defaultWorstCaseCount = 4;
 
 const defaultIterationCount = 120;
 const defaultWorstCaseCount = 4;
 
+let showScoreDetails = false;
+let categoryScores = null;
+
+function displayCategoryScores() {
+    if (!categoryScores)
+        return;
+
+    let summaryElement = document.getElementById("result-summary");
+    for (let [category, scores] of categoryScores)
+        summaryElement.innerHTML += `<p> ${category}: ${uiFriendlyNumber(geomean(scores))}</p>`
+
+    categoryScores = null;
+}
+
+if (isInBrowser) {
+    document.onkeydown = (keyboardEvent) => {
+        let key = keyboardEvent.key;
+        if (key === "d" || key === "D") {
+            showScoreDetails = true;
+
+            displayCategoryScores();
+        }
+    };
+}
+
 function assert(b, m = "") {
     if (!b)
         throw new Error("Bad assertion: " + m);
 function assert(b, m = "") {
     if (!b)
         throw new Error("Bad assertion: " + m);
@@ -174,7 +199,6 @@ class Driver {
             await updateUI();
 
             try {
             await updateUI();
 
             try {
-
                 await benchmark.run();
             } catch(e) {
                 JetStream.reportError(benchmark);
                 await benchmark.run();
             } catch(e) {
                 JetStream.reportError(benchmark);
@@ -197,12 +221,33 @@ class Driver {
         for (let benchmark of this.benchmarks)
             allScores.push(benchmark.score);
 
         for (let benchmark of this.benchmarks)
             allScores.push(benchmark.score);
 
+        categoryScores = new Map;
+        for (let benchmark of this.benchmarks) {
+            for (let category of Object.keys(benchmark.subTimes()))
+                categoryScores.set(category, []);
+        }
+
+        for (let benchmark of this.benchmarks) {
+            for (let [category, value] of Object.entries(benchmark.subTimes())) {
+                let arr = categoryScores.get(category);
+                arr.push(value);
+            }
+        }
+
         if (isInBrowser) {
             summaryElement.classList.add('done');
             summaryElement.innerHTML = "<div class=\"score\">" + uiFriendlyNumber(geomean(allScores)) + "</div><label>Score</label>";
         if (isInBrowser) {
             summaryElement.classList.add('done');
             summaryElement.innerHTML = "<div class=\"score\">" + uiFriendlyNumber(geomean(allScores)) + "</div><label>Score</label>";
+            summaryElement.onclick = displayCategoryScores;
+            if (showScoreDetails)
+                displayCategoryScores();
             statusElement.innerHTML = '';
             statusElement.innerHTML = '';
-        } else
+        } else {
+            console.log("\n");
+            for (let [category, scores] of categoryScores)
+                console.log(`${category}: ${uiFriendlyNumber(geomean(scores))}`);
+
             console.log("\nTotal Score: ", uiFriendlyNumber(geomean(allScores)), "\n");
             console.log("\nTotal Score: ", uiFriendlyNumber(geomean(allScores)), "\n");
+        }
 
         this.reportScoreToRunBenchmarkRunner();
     }
 
         this.reportScoreToRunBenchmarkRunner();
     }
@@ -331,7 +376,7 @@ class Driver {
                     "Time": ["Geometric"],
                 },
                 "tests": subResults,
                     "Time": ["Geometric"],
                 },
                 "tests": subResults,
-            };;
+            };
         }
 
         results = {"JetStream2.0": {"metrics" : {"Score" : ["Geometric"]}, "tests" : results}};
         }
 
         results = {"JetStream2.0": {"metrics" : {"Score" : ["Geometric"]}, "tests" : results}};