| OLD | NEW |
| 1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p
erftests | 1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p
erftests |
| 2 | 2 |
| 3 // We need access to console.memory for the memory measurements | 3 // We need access to console.memory for the memory measurements |
| 4 if (window.internals) | 4 if (window.internals) |
| 5 internals.settings.setMemoryInfoEnabled(true); | 5 internals.settings.setMemoryInfoEnabled(true); |
| 6 | 6 |
| 7 if (window.testRunner) { | 7 if (window.testRunner) { |
| 8 testRunner.waitUntilDone(); | 8 testRunner.waitUntilDone(); |
| 9 testRunner.dumpAsText(); | 9 testRunner.dumpAsText(); |
| 10 } | 10 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 window.scrollTo(0, document.body.height); | 135 window.scrollTo(0, document.body.height); |
| 136 } | 136 } |
| 137 | 137 |
| 138 PerfTestRunner.log = function (text) { | 138 PerfTestRunner.log = function (text) { |
| 139 if (logLines) | 139 if (logLines) |
| 140 logLines.push(text); | 140 logLines.push(text); |
| 141 else | 141 else |
| 142 logInDocument(text); | 142 logInDocument(text); |
| 143 } | 143 } |
| 144 | 144 |
| 145 function logFatalError(text) { | 145 PerfTestRunner.logFatalError = function (text) { |
| 146 PerfTestRunner.log(text); | 146 PerfTestRunner.log(text); |
| 147 finish(); | 147 finish(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 function start(test, runner) { | 150 function start(test, runner) { |
| 151 if (!test) { | 151 if (!test) { |
| 152 logFatalError("Got a bad test object."); | 152 PerfTestRunner.logFatalError("Got a bad test object."); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 currentTest = test; | 155 currentTest = test; |
| 156 // FIXME: We should be using multiple instances of test runner on Dromae
o as well but it's too slow now. | 156 // FIXME: We should be using multiple instances of test runner on Dromae
o as well but it's too slow now. |
| 157 // FIXME: Don't hard code the number of in-process iterations to use ins
ide a test runner. | 157 // FIXME: Don't hard code the number of in-process iterations to use ins
ide a test runner. |
| 158 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 :
20); | 158 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 :
20); |
| 159 logLines = window.testRunner ? [] : null; | 159 logLines = window.testRunner ? [] : null; |
| 160 PerfTestRunner.log("Running " + iterationCount + " times"); | 160 PerfTestRunner.log("Running " + iterationCount + " times"); |
| 161 if (test.doNotIgnoreInitialRun) | 161 if (test.doNotIgnoreInitialRun) |
| 162 completedIterations++; | 162 completedIterations++; |
| 163 if (runner) | 163 if (runner) |
| 164 scheduleNextRun(runner); | 164 scheduleNextRun(runner); |
| 165 } | 165 } |
| 166 | 166 |
| 167 function scheduleNextRun(runner) { | 167 function scheduleNextRun(runner) { |
| 168 PerfTestRunner.gc(); | 168 PerfTestRunner.gc(); |
| 169 window.setTimeout(function () { | 169 window.setTimeout(function () { |
| 170 try { | 170 try { |
| 171 if (currentTest.setup) | 171 if (currentTest.setup) |
| 172 currentTest.setup(); | 172 currentTest.setup(); |
| 173 | 173 |
| 174 var measuredValue = runner(); | 174 var measuredValue = runner(); |
| 175 } catch (exception) { | 175 } catch (exception) { |
| 176 logFatalError("Got an exception while running test.run with name
=" + exception.name + ", message=" + exception.message); | 176 PerfTestRunner.logFatalError("Got an exception while running tes
t.run with name=" + exception.name + ", message=" + exception.message); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| 180 completedIterations++; | 180 completedIterations++; |
| 181 | 181 |
| 182 try { | 182 try { |
| 183 ignoreWarmUpAndLog(measuredValue); | 183 ignoreWarmUpAndLog(measuredValue); |
| 184 } catch (exception) { | 184 } catch (exception) { |
| 185 logFatalError("Got an exception while logging the result with na
me=" + exception.name + ", message=" + exception.message); | 185 PerfTestRunner.logFatalError("Got an exception while logging the
result with name=" + exception.name + ", message=" + exception.message); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 | 188 |
| 189 if (completedIterations < iterationCount) | 189 if (completedIterations < iterationCount) |
| 190 scheduleNextRun(runner); | 190 scheduleNextRun(runner); |
| 191 else | 191 else |
| 192 finish(); | 192 finish(); |
| 193 }, 0); | 193 }, 0); |
| 194 } | 194 } |
| 195 | 195 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 PerfTestRunner.unit = test.unit; | 232 PerfTestRunner.unit = test.unit; |
| 233 start(test); | 233 start(test); |
| 234 } | 234 } |
| 235 | 235 |
| 236 PerfTestRunner.measureValueAsync = function (measuredValue) { | 236 PerfTestRunner.measureValueAsync = function (measuredValue) { |
| 237 completedIterations++; | 237 completedIterations++; |
| 238 | 238 |
| 239 try { | 239 try { |
| 240 ignoreWarmUpAndLog(measuredValue); | 240 ignoreWarmUpAndLog(measuredValue); |
| 241 } catch (exception) { | 241 } catch (exception) { |
| 242 logFatalError("Got an exception while logging the result with name="
+ exception.name + ", message=" + exception.message); | 242 PerfTestRunner.logFatalError("Got an exception while logging the res
ult with name=" + exception.name + ", message=" + exception.message); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 | 245 |
| 246 if (completedIterations >= iterationCount) | 246 if (completedIterations >= iterationCount) |
| 247 finish(); | 247 finish(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 PerfTestRunner.measureTime = function (test) { | 250 PerfTestRunner.measureTime = function (test) { |
| 251 PerfTestRunner.unit = "ms"; | 251 PerfTestRunner.unit = "ms"; |
| 252 start(test, measureTimeOnce); | 252 start(test, measureTimeOnce); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 iframe.contentDocument.close(); | 334 iframe.contentDocument.close(); |
| 335 document.body.removeChild(iframe); | 335 document.body.removeChild(iframe); |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 PerfTestRunner.measureTime(test); | 338 PerfTestRunner.measureTime(test); |
| 339 } | 339 } |
| 340 | 340 |
| 341 window.PerfTestRunner = PerfTestRunner; | 341 window.PerfTestRunner = PerfTestRunner; |
| 342 })(); | 342 })(); |
| OLD | NEW |