| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 function PerfRunner(options) { | 2 function PerfRunner(options) { |
| 3 this.unit_ = options.unit || "ms"; | 3 this.unit_ = options.unit || "ms"; |
| 4 this.iterationsRemaining_ = options.iterations || 10; | 4 this.iterationsRemaining_ = options.iterations || 10; |
| 5 this.results_ = []; | 5 this.results_ = []; |
| 6 this.setup_ = options.setup; | 6 this.setup_ = options.setup; |
| 7 this.logLines_ = []; |
| 7 } | 8 } |
| 8 | 9 |
| 9 PerfRunner.prototype.log = function(line) { | 10 PerfRunner.prototype.log = function(line) { |
| 10 console.log(line); | 11 this.logLines_.push(line); |
| 11 }; | 12 }; |
| 12 | 13 |
| 13 PerfRunner.prototype.recordResult = function(result) { | 14 PerfRunner.prototype.recordResult = function(result) { |
| 14 console.log(result); | |
| 15 this.results_.push(result); | 15 this.results_.push(result); |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 PerfRunner.prototype.runAsync = function(test) { | 18 PerfRunner.prototype.runAsync = function(test) { |
| 19 var self = this; | 19 var self = this; |
| 20 window.setTimeout(function() { | 20 window.setTimeout(function() { |
| 21 if (self.setup_) { | 21 if (self.setup_) { |
| 22 var setup = self.setup_; | 22 var setup = self.setup_; |
| 23 setup(); | 23 setup(); |
| 24 } | 24 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 this.log("values " + stats.values.join(", ") + " " + stats.unit); | 75 this.log("values " + stats.values.join(", ") + " " + stats.unit); |
| 76 this.log("avg " + stats.mean + " " + stats.unit); | 76 this.log("avg " + stats.mean + " " + stats.unit); |
| 77 this.log("median " + stats.median + " " + stats.unit); | 77 this.log("median " + stats.median + " " + stats.unit); |
| 78 this.log("stdev " + stats.stdev + " " + stats.unit); | 78 this.log("stdev " + stats.stdev + " " + stats.unit); |
| 79 this.log("min " + stats.min + " " + stats.unit); | 79 this.log("min " + stats.min + " " + stats.unit); |
| 80 this.log("max " + stats.max + " " + stats.unit); | 80 this.log("max " + stats.max + " " + stats.unit); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 PerfRunner.prototype.finish = function () { | 83 PerfRunner.prototype.finish = function () { |
| 84 this.logStatistics("Time:"); | 84 this.logStatistics("Time:"); |
| 85 internals.notifyTestComplete(this.logLines_.join('\n')); |
| 85 } | 86 } |
| 86 | 87 |
| 87 module.exports = PerfRunner; | 88 module.exports = PerfRunner; |
| 88 </script> | 89 </script> |
| OLD | NEW |