File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ load('runtime.js');
8888// Main
8989// ===============================
9090
91- B = new Benchmarker ( ) ;
91+ global . B = new Benchmarker ( ) ;
9292
9393try {
9494 runJSify ( ) ;
Original file line number Diff line number Diff line change @@ -152,7 +152,8 @@ function isPowerOfTwo(x) {
152152function Benchmarker ( ) {
153153 const totals = { } ;
154154 const ids = [ ] ;
155- const lastTime = 0 ;
155+ const startTime = Date . now ( ) ;
156+ let lastTime = 0 ;
156157 this . start = function ( id ) {
157158 const now = Date . now ( ) ;
158159 if ( ids . length > 0 ) {
@@ -172,8 +173,10 @@ function Benchmarker() {
172173 this . print = function ( text ) {
173174 const ids = Object . keys ( totals ) ;
174175 if ( ids . length > 0 ) {
176+ const now = Date . now ( ) ;
175177 ids . sort ( ( a , b ) => totals [ b ] - totals [ a ] ) ;
176178 printErr ( text + ' times: \n' + ids . map ( ( id ) => id + ' : ' + totals [ id ] + ' ms' ) . join ( '\n' ) ) ;
179+ printErr ( `total: ${ now - startTime } ` ) ;
177180 }
178181 } ;
179182}
You can’t perform that action at this time.
0 commit comments