Chromium Code Reviews| 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 library fasta.outline; | 5 library fasta.outline; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:convert' show JSON; | |
| 10 | |
| 9 import 'dart:io' show exitCode; | 11 import 'dart:io' show exitCode; |
| 10 | 12 |
| 11 import 'kernel/verifier.dart' show verifyProgram; | 13 import 'kernel/verifier.dart' show verifyProgram; |
| 12 | 14 |
| 13 import 'compiler_command_line.dart' show CompilerCommandLine; | 15 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 14 | 16 |
| 15 import 'compiler_context.dart' show CompilerContext; | 17 import 'compiler_context.dart' show CompilerContext; |
| 16 | 18 |
| 17 import 'errors.dart' show InputError, inputError; | 19 import 'errors.dart' show InputError, inputError; |
| 18 | 20 |
| 19 import 'kernel/kernel_target.dart' show KernelTarget; | 21 import 'kernel/kernel_target.dart' show KernelTarget; |
| 20 | 22 |
| 21 import 'dill/dill_target.dart' show DillTarget; | 23 import 'dill/dill_target.dart' show DillTarget; |
| 22 | 24 |
| 23 import 'ticker.dart' show Ticker; | 25 import 'ticker.dart' show Ticker; |
| 24 | 26 |
| 25 import 'translate_uri.dart' show TranslateUri; | 27 import 'translate_uri.dart' show TranslateUri; |
| 26 | 28 |
| 29 const bool summary = const bool.fromEnvironment("summary", defaultValue: false); | |
| 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); | 30 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 28 | 31 |
| 29 compileEntryPoint(List<String> arguments) async { | 32 compileEntryPoint(List<String> arguments) async { |
| 33 // Timing results for each iteration | |
| 34 List<double> elapseTimes = <double>[]; | |
|
Paul Berry
2017/03/09 16:58:25
Nit: I think you mean "elapsedTimes"
danrubel
2017/03/09 19:05:16
Yes. Fixed.
| |
| 35 | |
| 30 for (int i = 0; i < iterations; i++) { | 36 for (int i = 0; i < iterations; i++) { |
| 31 if (i > 0) { | 37 if (i > 0) { |
| 32 print("\n"); | 38 print("\n\n=== Iteration ${i+1} of $iterations"); |
| 33 } | 39 } |
| 40 var stopwatch = new Stopwatch()..start(); | |
| 34 await compile(arguments); | 41 await compile(arguments); |
| 42 stopwatch.stop(); | |
| 43 | |
| 44 elapseTimes.add(stopwatch.elapsedMilliseconds.toDouble()); | |
| 45 } | |
| 46 | |
| 47 if (summary) { | |
| 48 var json = JSON.encode(<String, dynamic>{'elapseTimes': elapseTimes}); | |
|
Paul Berry
2017/03/09 16:58:25
Here as well (in the string)
danrubel
2017/03/09 19:05:16
Done.
| |
| 49 print('\nSummary: $json'); | |
| 35 } | 50 } |
| 36 } | 51 } |
| 37 | 52 |
| 38 outlineEntryPoint(List<String> arguments) async { | 53 outlineEntryPoint(List<String> arguments) async { |
| 39 for (int i = 0; i < iterations; i++) { | 54 for (int i = 0; i < iterations; i++) { |
| 40 if (i > 0) { | 55 if (i > 0) { |
| 41 print("\n"); | 56 print("\n"); |
| 42 } | 57 } |
| 43 await outline(arguments); | 58 await outline(arguments); |
| 44 } | 59 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 exitCode = 1; | 148 exitCode = 1; |
| 134 print("Verification of program failed: $e"); | 149 print("Verification of program failed: $e"); |
| 135 if (s != null && c.options.verbose) { | 150 if (s != null && c.options.verbose) { |
| 136 print(s); | 151 print(s); |
| 137 } | 152 } |
| 138 } | 153 } |
| 139 } | 154 } |
| 140 return uri; | 155 return uri; |
| 141 } | 156 } |
| 142 } | 157 } |
| OLD | NEW |