| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Invoke the fasta kernel generator for the program starting in [entryUri] | 237 // Invoke the fasta kernel generator for the program starting in [entryUri] |
| 238 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. | 238 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. |
| 239 generateKernel(Uri entryUri, | 239 generateKernel(Uri entryUri, |
| 240 {bool compileSdk: true, bool strongMode: false}) async { | 240 {bool compileSdk: true, bool strongMode: false}) async { |
| 241 // TODO(sigmund): this is here only to compute the input size, | 241 // TODO(sigmund): this is here only to compute the input size, |
| 242 // we should extract the input size from the frontend instead. | 242 // we should extract the input size from the frontend instead. |
| 243 scanReachableFiles(entryUri); | 243 scanReachableFiles(entryUri); |
| 244 | 244 |
| 245 var timer = new Stopwatch()..start(); | 245 var timer = new Stopwatch()..start(); |
| 246 final Ticker ticker = new Ticker(); | 246 final Ticker ticker = new Ticker(); |
| 247 final DillTarget dillTarget = new DillTarget(ticker, uriResolver); | 247 final DillTarget dillTarget = new DillTarget(ticker, uriResolver, strongMode); |
| 248 final KernelTarget kernelTarget = | 248 final KernelTarget kernelTarget = |
| 249 new KernelTarget(dillTarget, uriResolver, strongMode); | 249 new KernelTarget(dillTarget, uriResolver, strongMode); |
| 250 var entrypoints = [ | 250 var entrypoints = [ |
| 251 entryUri, | 251 entryUri, |
| 252 // These extra libraries are added to match the same set of libraries | 252 // These extra libraries are added to match the same set of libraries |
| 253 // scanned by default by the VM and the other benchmarks. | 253 // scanned by default by the VM and the other benchmarks. |
| 254 Uri.parse('dart:async'), | 254 Uri.parse('dart:async'), |
| 255 Uri.parse('dart:collection'), | 255 Uri.parse('dart:collection'), |
| 256 Uri.parse('dart:convert'), | 256 Uri.parse('dart:convert'), |
| 257 Uri.parse('dart:core'), | 257 Uri.parse('dart:core'), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 283 /// Report that metric [name] took [time] micro-seconds to process | 283 /// Report that metric [name] took [time] micro-seconds to process |
| 284 /// [inputSize] characters. | 284 /// [inputSize] characters. |
| 285 void report(String name, int time) { | 285 void report(String name, int time) { |
| 286 var sb = new StringBuffer(); | 286 var sb = new StringBuffer(); |
| 287 var padding = ' ' * (20 - name.length); | 287 var padding = ' ' * (20 - name.length); |
| 288 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); | 288 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); |
| 289 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); | 289 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); |
| 290 sb.write(', $invSpeed ns/char'); | 290 sb.write(', $invSpeed ns/char'); |
| 291 print('$sb'); | 291 print('$sb'); |
| 292 } | 292 } |
| OLD | NEW |