| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Invoke the fasta kernel generator for the program starting in [entryUri] | 207 // Invoke the fasta kernel generator for the program starting in [entryUri] |
| 208 // TODO(sigmund): update to use the frontend api once fasta is being hit. | 208 // TODO(sigmund): update to use the frontend api once fasta is being hit. |
| 209 generateKernel(Uri entryUri, | 209 generateKernel(Uri entryUri, |
| 210 {bool compileSdk: true, bool strongMode: false}) async { | 210 {bool compileSdk: true, bool strongMode: false}) async { |
| 211 // TODO(sigmund): this is here only to compute the input size, | 211 // TODO(sigmund): this is here only to compute the input size, |
| 212 // we should extract the input size from the frontend instead. | 212 // we should extract the input size from the frontend instead. |
| 213 scanReachableFiles(entryUri); | 213 scanReachableFiles(entryUri); |
| 214 | 214 |
| 215 var timer = new Stopwatch()..start(); | 215 var timer = new Stopwatch()..start(); |
| 216 final Ticker ticker = new Ticker(); | 216 final Ticker ticker = new Ticker(); |
| 217 final DillTarget dillTarget = new DillTarget(ticker, uriResolver, "vm"); | 217 final DillTarget dillTarget = new DillTarget(ticker, uriResolver, "vm_fasta"); |
| 218 final KernelTarget kernelTarget = new KernelTarget( | 218 final KernelTarget kernelTarget = new KernelTarget( |
| 219 PhysicalFileSystem.instance, dillTarget, uriResolver, strongMode); | 219 PhysicalFileSystem.instance, dillTarget, uriResolver, strongMode); |
| 220 var entrypoints = [ | 220 var entrypoints = [ |
| 221 entryUri, | 221 entryUri, |
| 222 // These extra libraries are added to match the same set of libraries | 222 // These extra libraries are added to match the same set of libraries |
| 223 // scanned by default by the VM and the other benchmarks. | 223 // scanned by default by the VM and the other benchmarks. |
| 224 Uri.parse('dart:async'), | 224 Uri.parse('dart:async'), |
| 225 Uri.parse('dart:collection'), | 225 Uri.parse('dart:collection'), |
| 226 Uri.parse('dart:convert'), | 226 Uri.parse('dart:convert'), |
| 227 Uri.parse('dart:core'), | 227 Uri.parse('dart:core'), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 253 /// Report that metric [name] took [time] micro-seconds to process | 253 /// Report that metric [name] took [time] micro-seconds to process |
| 254 /// [inputSize] characters. | 254 /// [inputSize] characters. |
| 255 void report(String name, int time) { | 255 void report(String name, int time) { |
| 256 var sb = new StringBuffer(); | 256 var sb = new StringBuffer(); |
| 257 var padding = ' ' * (20 - name.length); | 257 var padding = ' ' * (20 - name.length); |
| 258 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); | 258 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); |
| 259 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); | 259 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); |
| 260 sb.write(', $invSpeed ns/char'); | 260 sb.write(', $invSpeed ns/char'); |
| 261 print('$sb'); | 261 print('$sb'); |
| 262 } | 262 } |
| OLD | NEW |