diff --git a/Full.html b/Full.html index 419b9f2..0b04c69 100644 --- a/Full.html +++ b/Full.html @@ -7,7 +7,6 @@ - diff --git a/resources/benchmark-report.js b/resources/benchmark-report.js index c4b4c64..874f597 100644 --- a/resources/benchmark-report.js +++ b/resources/benchmark-report.js @@ -1,30 +1,26 @@ // This file can be customized to report results as needed. (function () { - if (!window.testRunner && location.search != '?webkit' && location.hash != '#webkit') - return; - if (window.testRunner) testRunner.waitUntilDone(); - var scriptElement = document.createElement('script'); - scriptElement.src = '../resources/runner.js'; - document.head.appendChild(scriptElement); - - var styleElement = document.createElement('style'); - styleElement.textContent = 'pre { padding-top: 600px; }'; - document.head.appendChild(styleElement); - + showSection('running') var createTest; var valuesByIteration = new Array; + var timeValues = new Array; window.onload = function () { - document.body.removeChild(document.querySelector('main')); startBenchmark(); } window.benchmarkClient = { iterationCount: 5, // Use 4 different instances of DRT/WTR to run 5 iterations. + willAddTestFrame: function (frame) { + var main = document.querySelector('main'); + var style = getComputedStyle(main); + frame.style.left = main.offsetLeft + parseInt(style.borderLeftWidth) + parseInt(style.paddingLeft) + 'px'; + frame.style.top = main.offsetTop + parseInt(style.borderTopWidth) + parseInt(style.paddingTop) + 'px'; + }, willStartFirstIteration: function (iterationCount) { createTest = function (name, aggregator, isLastTest) { return { @@ -36,15 +32,12 @@ name: name, aggregator: aggregator}; } - PerfTestRunner.prepareToMeasureValuesAsync(createTest(null, 'Total')); }, didRunSuites: function (measuredValues) { - PerfTestRunner.measureValueAsync(measuredValues.total); valuesByIteration.push(measuredValues.tests); + timeValues.push(measuredValues.total); }, didFinishLastIteration: function () { - document.head.removeChild(document.querySelector('style')); - var measuredValuesByFullName = {}; function addToMeasuredValue(value, fullName, aggregator) { var values = measuredValuesByFullName[fullName] || new Array; @@ -52,19 +45,30 @@ values.push(value); values.aggregator = aggregator; } - + var dict = {} + var scores= timeValues.map(computeScore); + function addToDictionaryValue(value, suiteName, testName, subtestName) { + dict["Speedometer"] = dict["Speedometer"] || { "metrics" : { "Time" : [ "Total", ], "Score": { "current" : [scores] } }, "tests" : {}}; + dict["Speedometer"]["tests"][suiteName] = dict["Speedometer"]["tests"][suiteName] || {"metrics" : { "Time" : [ "Total", ] }, "tests" : {}}; + dict["Speedometer"]["tests"][suiteName]["tests"][testName] = dict["Speedometer"]["tests"][suiteName]["tests"][testName] || { "metrics" : { "Time" : [ "Total", ] }, "tests" : {}}; + dict["Speedometer"]["tests"][suiteName]["tests"][testName]["tests"][subtestName] = dict["Speedometer"]["tests"][suiteName]["tests"][testName]["tests"][subtestName] || { "metrics" : { "Time" : { "current" : [[]] } }}; + dict["Speedometer"]["tests"][suiteName]["tests"][testName]["tests"][subtestName]["metrics"]["Time"]["current"][0].push(value); + } valuesByIteration.forEach(function (measuredValues) { for (var suiteName in measuredValues) { var suite = measuredValues[suiteName]; for (var testName in suite.tests) { var test = suite.tests[testName]; - for (var subtestName in test.tests) + for (var subtestName in test.tests) { addToMeasuredValue(test.tests[subtestName], suiteName + '/' + testName + '/' + subtestName); + addToDictionaryValue(test.tests[subtestName], suiteName, testName, subtestName); + } addToMeasuredValue(test.total, suiteName + '/' + testName, 'Total'); } addToMeasuredValue(suite.total, suiteName, 'Total'); } }); + var results = JSON.stringify(dict); var fullNames = new Array; for (var fullName in measuredValuesByFullName) @@ -72,8 +76,22 @@ for (var i = 0; i < fullNames.length; i++) { var values = measuredValuesByFullName[fullNames[i]]; - PerfTestRunner.reportValues(createTest(fullNames[i], values.aggregator, i + 1 == fullNames.length), values); } + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/report"); + + xhr.setRequestHeader("Content-type", "application/json"); + xhr.setRequestHeader("Content-length", results.length); + xhr.setRequestHeader("Connection", "close"); + + xhr.onreadystatechange = function() { + if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { + var closeRequest = new XMLHttpRequest(); + closeRequest.open("GET", "/shutdown"); + closeRequest.send() + } + } + xhr.send(results); } }; })();