Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: sky/benchmarks/resources/runner.sky

Issue 701813004: Add a microbenchmark for simple block layout (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fixenated Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/benchmarks/layout/simple-blocks.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 } 7 }
7 8
8 PerfRunner.prototype.log = function(line) { 9 PerfRunner.prototype.log = function(line) {
9 console.log(line); 10 console.log(line);
10 }; 11 };
11 12
12 PerfRunner.prototype.recordResult = function(result) { 13 PerfRunner.prototype.recordResult = function(result) {
13 console.log(result); 14 console.log(result);
14 this.results_.push(result); 15 this.results_.push(result);
15 }; 16 };
16 17
17 PerfRunner.prototype.runAsync = function(test) { 18 PerfRunner.prototype.runAsync = function(test) {
18 var self = this; 19 var self = this;
19 window.setTimeout(function() { 20 window.setTimeout(function() {
21 if (self.setup_) {
22 var setup = self.setup_;
23 setup();
24 }
25
20 var startTime = Date.now(); 26 var startTime = Date.now();
21 test(function() { 27 test(function() {
22 var endTime = Date.now(); 28 var endTime = Date.now();
29
23 self.recordResult(endTime - startTime); 30 self.recordResult(endTime - startTime);
24 if (--self.iterationsRemaining_ > 0) 31 if (--self.iterationsRemaining_ > 0)
25 self.runAsync(test); 32 self.runAsync(test);
26 else 33 else
27 self.finish(); 34 self.finish();
28 }); 35 });
29 }); 36 });
30 }; 37 };
31 38
32 PerfRunner.prototype.computeStatistics = function() { 39 PerfRunner.prototype.computeStatistics = function() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 this.log("min " + stats.min + " " + stats.unit); 79 this.log("min " + stats.min + " " + stats.unit);
73 this.log("max " + stats.max + " " + stats.unit); 80 this.log("max " + stats.max + " " + stats.unit);
74 }; 81 };
75 82
76 PerfRunner.prototype.finish = function () { 83 PerfRunner.prototype.finish = function () {
77 this.logStatistics("Time:"); 84 this.logStatistics("Time:");
78 } 85 }
79 86
80 module.exports = PerfRunner; 87 module.exports = PerfRunner;
81 </script> 88 </script>
OLDNEW
« no previous file with comments | « sky/benchmarks/layout/simple-blocks.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698