run-benchmark should support Dromaeo
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / data / patches / Dromaeo.patch
1 diff --git a/web/webrunner.js b/web/webrunner.js
2 index 63d777b..953c026 100755
3 --- a/web/webrunner.js
4 +++ b/web/webrunner.js
5 @@ -156,6 +156,7 @@
6  
7                         // Make Sum
8                         results.sum = 0;
9 +                       results.times = times;
10  
11                         for ( var i = 0; i < num; i++ )
12                                 results.sum += times[i];
13 @@ -271,6 +272,7 @@
14                         numTests = Number(m[1]);
15         }
16  
17 +       var currentSuiteName = null;
18         jQuery(function(){
19                 var id = search.match(/id=([\d,]+)/);
20  
21 @@ -282,6 +284,7 @@
22                 var cat = filter.toString().slice(1,-2);
23  
24                 if ( catnames[cat] ) {
25 +                       currentSuiteName = catnames[cat];
26                         $("#overview span:first").html( catnames[cat] );
27  
28                         if ( catnames[cat].length > 22 ) {
29 @@ -359,6 +362,25 @@
30                         $("#overview input").remove();
31                         updateTimebar();
32  
33 +                       var mean = (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal);
34 +                       var resultsDict = {"Dromaeo": {"tests": {}}};
35 +                       resultsDict["Dromaeo"]["tests"][currentSuiteName] = {"metrics": {"Runs": {"current": [mean]}}, "tests": subTests};
36 +                       var results = JSON.stringify(resultsDict);
37 +                       var xhr = new XMLHttpRequest();
38 +                       xhr.open("POST", "/report");
39 +                       xhr.setRequestHeader("Content-Type", "application/json");
40 +                       xhr.setRequestHeader("Content-Length", results.length);
41 +                       xhr.setRequestHeader("Connection", "close");
42 +                       xhr.onreadystatechange = function() {
43 +                       if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
44 +                                       closeRequest = new XMLHttpRequest();
45 +                                       closeRequest.open("GET", "/shutdown");
46 +                                       closeRequest.send();
47 +                               }
48 +                       }
49 +                       xhr.send(results);
50 +                       return;
51 +
52                         if ( window.limitSearch ) {
53                                 var summary = (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toFixed(2);
54  
55 @@ -421,7 +443,5 @@
56                                 }
57                         });
58  
59 -               if ( window.limitSearch ) {
60 -                       $("#pause").click();
61 -               }
62 +               $("#pause").click();
63         }
64 @@ -673,8 +695,18 @@
65  
66                 $("#timebar").width((w < 1 ? 1 : w) + "%");
67         }
68 -       
69 +
70 +       var subTests = {};
71         function logTest(data){
72 +               var subTestName = tests[data.curID].name; // e.g. DOM Attributes
73 +               if (!subTests[subTestName]) {
74 +                       subTests[subTestName] = {
75 +                               "metrics": {"Runs": {}},
76 +                               "tests": {}
77 +                       }
78 +               }
79 +               subTests[subTestName]["tests"][data.name] = {"metrics": {"Runs": {"current": [data.times]}}};
80 +
81                 // Keep a running summary going
82                 data.mean = parseFloat(data.mean);
83                 var mean = (runStyle === "runs/s" ? Math.log(data.mean) : data.mean);
84 @@ -711,6 +743,8 @@
85                         per + "%;'>" + (per >= 100 ? "<span>" + mean.toFixed(2) + runStyle + "</span>" : "") + "</div></div>");
86  
87                 if ( per >= 100 && testSummary[data.curID] > 0 ) {
88 +                       var subTestName = tests[data.curID].name; // e.g. DOM Attributes
89 +                       subTests[subTestName]["metrics"]["Runs"]["current"] = [mean];
90                         testElems[data.curID].parent().addClass("done");
91                 }
92         }