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

Side by Side Diff: utils/template/tool.dart

Issue 11265024: Make methods in Stopwatch getters and rename to be more consistent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « utils/css/world.dart ('k') | utils/template/world.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('templatetool'); 5 #library('templatetool');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('template.dart'); 8 #import('template.dart');
9 #import('../lib/file_system.dart'); 9 #import('../lib/file_system.dart');
10 #import('../lib/file_system_vm.dart'); 10 #import('../lib/file_system_vm.dart');
11 11
12 12
13 FileSystem files; 13 FileSystem files;
14 14
15 /** Invokes [callback] and returns how long it took to execute in ms. */ 15 /** Invokes [callback] and returns how long it took to execute in ms. */
16 num time(callback()) { 16 num time(callback()) {
17 final watch = new Stopwatch(); 17 final watch = new Stopwatch();
18 watch.start(); 18 watch.start();
19 callback(); 19 callback();
20 watch.stop(); 20 watch.stop();
21 return watch.elapsedInMs(); 21 return watch.elapsedMilliseconds;
22 } 22 }
23 23
24 String GREEN_COLOR = '\u001b[32m'; 24 String GREEN_COLOR = '\u001b[32m';
25 String NO_COLOR = '\u001b[0m'; 25 String NO_COLOR = '\u001b[0m';
26 26
27 printStats(String phase, num elapsed, [String filename = '']) { 27 printStats(String phase, num elapsed, [String filename = '']) {
28 print('${phase} ${GREEN_COLOR}${filename}${NO_COLOR} in ${elapsed} msec.'); 28 print('${phase} ${GREEN_COLOR}${filename}${NO_COLOR} in ${elapsed} msec.');
29 } 29 }
30 30
31 /** 31 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 printStats("Parsed", parsedElapsed, sourceFullFn); 100 printStats("Parsed", parsedElapsed, sourceFullFn);
101 printStats("Codegen", codegenElapsed, sourceFullFn); 101 printStats("Codegen", codegenElapsed, sourceFullFn);
102 102
103 final outputElapsed = time(() { 103 final outputElapsed = time(() {
104 files.writeString(outputFullFn, code.toString()); 104 files.writeString(outputFullFn, code.toString());
105 }); 105 });
106 106
107 printStats("Wrote file", codegenElapsed, outputFullFn); 107 printStats("Wrote file", codegenElapsed, outputFullFn);
108 } 108 }
109 } 109 }
OLDNEW
« no previous file with comments | « utils/css/world.dart ('k') | utils/template/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698