| OLD | NEW |
| 1 if (!window.PerfTestRunner) | 1 if (!window.PerfTestRunner) |
| 2 console.log("measure-gc.js requires PerformanceTests/resources/runner.js to
be loaded."); | 2 console.log("measure-gc.js requires PerformanceTests/resources/runner.js to
be loaded."); |
| 3 if (!window.internals) | 3 if (!window.internals) |
| 4 console.log("measure-gc.js requires window.internals."); | 4 console.log("measure-gc.js requires window.internals."); |
| 5 if (!window.GCController && !window.gc) | 5 if (!window.GCController && !window.gc) |
| 6 console.log("measure-gc.js requires GCController or exposed gc()."); | 6 console.log("measure-gc.js requires GCController or exposed gc()."); |
| 7 | 7 |
| 8 (function (PerfTestRunner) { | 8 (function (PerfTestRunner) { |
| 9 var warmUpCount = 3; | 9 var warmUpCount = 3; |
| 10 var completedIterations = 0; | 10 var completedIterations = 0; |
| 11 | 11 |
| 12 PerfTestRunner.measureBlinkGCTime = function(test) { | 12 PerfTestRunner.measureBlinkGCTime = function(test) { |
| 13 if (!test.unit) | 13 if (!test.unit) |
| 14 test.unit = 'ms'; | 14 test.unit = 'ms'; |
| 15 if (!test.warmUpCount) | 15 if (!test.warmUpCount) |
| 16 test.warmUpCount = warmUpCount; | 16 test.warmUpCount = warmUpCount; |
| 17 if (!test.run) |
| 18 test.run = function() {}; |
| 17 | 19 |
| 18 completedIterations = 0; | 20 completedIterations = 0; |
| 19 PerfTestRunner.prepareToMeasureValuesAsync(test); | 21 PerfTestRunner.prepareToMeasureValuesAsync(test); |
| 20 | 22 |
| 21 // Force a V8 GC before running Blink GC test to avoid measuring marking
from stale V8 wrappers. | 23 // Force a V8 GC before running Blink GC test to avoid measuring marking
from stale V8 wrappers. |
| 22 if (window.GCController) | 24 if (window.GCController) |
| 23 GCController.collectAll(); | 25 GCController.collectAll(); |
| 24 else if (window.gc) { | 26 else if (window.gc) { |
| 25 for (var i = 0; i < 7; i++) | 27 for (var i = 0; i < 7; i++) |
| 26 gc(); | 28 gc(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 var end = PerfTestRunner.now(); | 45 var end = PerfTestRunner.now(); |
| 44 PerfTestRunner.measureValueAsync((end - start) / NumberOfGCRunsPerFo
rceBlinkGC); | 46 PerfTestRunner.measureValueAsync((end - start) / NumberOfGCRunsPerFo
rceBlinkGC); |
| 45 setTimeout(runTest, 0); | 47 setTimeout(runTest, 0); |
| 46 | 48 |
| 47 if (completedIterations > warmUpCount) | 49 if (completedIterations > warmUpCount) |
| 48 console.timeEnd("BlinkGCTimeMeasurement"); | 50 console.timeEnd("BlinkGCTimeMeasurement"); |
| 49 completedIterations++; | 51 completedIterations++; |
| 50 }, 0); | 52 }, 0); |
| 51 } | 53 } |
| 52 })(window.PerfTestRunner); | 54 })(window.PerfTestRunner); |
| OLD | NEW |