899251d1121bd20185b524e90cf966caa6713f65
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / data / patches / Kraken.patch
1 diff --git a/hosted/kraken-1.1/driver.html b/hosted/kraken-1.1/driver2.html
2 index bfb2c94..5ad1704 100644
3 --- a/hosted/kraken-1.1/driver.html
4 +++ b/hosted/kraken-1.1/driver2.html
5 @@ -117,20 +117,28 @@ function recordResult(time)
6  
7  function finish()
8  {
9 -    var outputString = "{";
10 -    outputString += '"v": "kraken-1.1", ';
11 +    var tests = {};
12      for (var test in output[0]) {
13 -        outputString += '"' + test + '":[';
14 -        for (var i = 0; i < output.length; i++) {
15 -             outputString += output[i][test] + ",";
16 -        }
17 -        outputString = outputString.substring(0, outputString.length - 1);
18 -        outputString += "],";
19 +        var values = new Array(output.length);
20 +        for (var i = 0; i < output.length; i++)
21 +            values[i] = output[i][test];
22 +        tests[test] = {"metrics": {"current": values}}
23      }
24 -    outputString = outputString.substring(0, outputString.length - 1);
25 -    outputString += "}";
26  
27 -    location = "results.html?" + encodeURI(outputString);
28 +    var results = JSON.stringify({"Kraken": {"metrics": {"Time": ["Total"]}, "tests": tests}});
29 +    var xhr = new XMLHttpRequest();
30 +    xhr.open("POST", "/report");
31 +    xhr.setRequestHeader("Content-Type", "application/json");
32 +    xhr.setRequestHeader("Content-Length", results.length);
33 +    xhr.setRequestHeader("Connection", "close");
34 +    xhr.onreadystatechange = function() {
35 +    if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
36 +            closeRequest = new XMLHttpRequest();
37 +            closeRequest.open("GET", "/shutdown");
38 +            closeRequest.send();
39 +        }
40 +    }
41 +    xhr.send(results);
42  }
43  
44  </script>