OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// An entrypoint used to run portions of analyzer and measure its performance. | 5 /// An entrypoint used to run portions of front_end and measure its performance. |
6 library analyzer_cli.tool.perf; | 6 library front_end.tool.perf; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io' show exit; | 9 import 'dart:io' show exit; |
10 | 10 |
11 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
12 import 'package:analyzer/dart/ast/token.dart'; | 12 import 'package:analyzer/dart/ast/token.dart'; |
13 import 'package:analyzer/error/listener.dart'; | 13 import 'package:analyzer/error/listener.dart'; |
14 import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver; | 14 import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver; |
15 import 'package:analyzer/file_system/physical_file_system.dart' | 15 import 'package:analyzer/file_system/physical_file_system.dart' |
16 show PhysicalResourceProvider; | 16 show PhysicalResourceProvider; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 /// Report that metric [name] took [time] micro-seconds to process | 196 /// Report that metric [name] took [time] micro-seconds to process |
197 /// [scanTotalChars] characters. | 197 /// [scanTotalChars] characters. |
198 void report(String name, int time) { | 198 void report(String name, int time) { |
199 var sb = new StringBuffer(); | 199 var sb = new StringBuffer(); |
200 sb.write('$name: $time us, ${time ~/ 1000} ms'); | 200 sb.write('$name: $time us, ${time ~/ 1000} ms'); |
201 sb.write(', ${scanTotalChars * 1000 ~/ time} chars/ms'); | 201 sb.write(', ${scanTotalChars * 1000 ~/ time} chars/ms'); |
202 print('$sb'); | 202 print('$sb'); |
203 } | 203 } |
OLD | NEW |