OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 fasta and measure its performance. | 5 /// An entrypoint used to run portions of fasta and measure its performance. |
6 library front_end.tool.fasta_perf; | 6 library front_end.tool.fasta_perf; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // bodies. So this listener is not feature complete. | 190 // bodies. So this listener is not feature complete. |
191 class _PartialAstBuilder extends AstBuilder { | 191 class _PartialAstBuilder extends AstBuilder { |
192 _PartialAstBuilder(Uri uri) : super(null, null, null, null, null, uri); | 192 _PartialAstBuilder(Uri uri) : super(null, null, null, null, null, uri); |
193 | 193 |
194 // Note: this method converts the body to kernel, so we skip that here. | 194 // Note: this method converts the body to kernel, so we skip that here. |
195 @override | 195 @override |
196 finishFunction(formals, asyncModifier, body) {} | 196 finishFunction(formals, asyncModifier, body) {} |
197 } | 197 } |
198 | 198 |
199 // Invoke the fasta kernel generator for the program starting in [entryUri] | 199 // Invoke the fasta kernel generator for the program starting in [entryUri] |
200 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. | 200 // TODO(sigmund): update to use the frontend api once fasta is being hit. |
201 generateKernel(Uri entryUri, | 201 generateKernel(Uri entryUri, |
202 {bool compileSdk: true, bool strongMode: false}) async { | 202 {bool compileSdk: true, bool strongMode: false}) async { |
203 // TODO(sigmund): this is here only to compute the input size, | 203 // TODO(sigmund): this is here only to compute the input size, |
204 // we should extract the input size from the frontend instead. | 204 // we should extract the input size from the frontend instead. |
205 scanReachableFiles(entryUri); | 205 scanReachableFiles(entryUri); |
206 | 206 |
207 var timer = new Stopwatch()..start(); | 207 var timer = new Stopwatch()..start(); |
208 final Ticker ticker = new Ticker(); | 208 final Ticker ticker = new Ticker(); |
209 final DillTarget dillTarget = new DillTarget(ticker, uriResolver); | 209 final DillTarget dillTarget = new DillTarget(ticker, uriResolver); |
210 final KernelTarget kernelTarget = | 210 final KernelTarget kernelTarget = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 /// Report that metric [name] took [time] micro-seconds to process | 245 /// Report that metric [name] took [time] micro-seconds to process |
246 /// [inputSize] characters. | 246 /// [inputSize] characters. |
247 void report(String name, int time) { | 247 void report(String name, int time) { |
248 var sb = new StringBuffer(); | 248 var sb = new StringBuffer(); |
249 var padding = ' ' * (20 - name.length); | 249 var padding = ' ' * (20 - name.length); |
250 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); | 250 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); |
251 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); | 251 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); |
252 sb.write(', $invSpeed ns/char'); | 252 sb.write(', $invSpeed ns/char'); |
253 print('$sb'); | 253 print('$sb'); |
254 } | 254 } |
OLD | NEW |