| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.common.tasks; | 5 library dart2js.common.tasks; |
| 6 | 6 |
| 7 import 'dart:developer' show | 7 import 'dart:developer' show |
| 8 UserTag; | 8 UserTag; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 class CompilerTask { | 25 class CompilerTask { |
| 26 final Compiler compiler; | 26 final Compiler compiler; |
| 27 final Stopwatch watch; | 27 final Stopwatch watch; |
| 28 UserTag profilerTag; | 28 UserTag profilerTag; |
| 29 final Map<String, GenericTask> _subtasks = <String, GenericTask>{}; | 29 final Map<String, GenericTask> _subtasks = <String, GenericTask>{}; |
| 30 | 30 |
| 31 CompilerTask(Compiler compiler) | 31 CompilerTask(Compiler compiler) |
| 32 : this.compiler = compiler, | 32 : this.compiler = compiler, |
| 33 watch = (compiler.verbose) ? new Stopwatch() : null; | 33 watch = (compiler.options.verbose) ? new Stopwatch() : null; |
| 34 | 34 |
| 35 DiagnosticReporter get reporter => compiler.reporter; | 35 DiagnosticReporter get reporter => compiler.reporter; |
| 36 | 36 |
| 37 String get name => "Unknown task '${this.runtimeType}'"; | 37 String get name => "Unknown task '${this.runtimeType}'"; |
| 38 | 38 |
| 39 int get timing { | 39 int get timing { |
| 40 if (watch == null) return 0; | 40 if (watch == null) return 0; |
| 41 int total = watch.elapsedMilliseconds; | 41 int total = watch.elapsedMilliseconds; |
| 42 for (GenericTask subtask in _subtasks.values) { | 42 for (GenericTask subtask in _subtasks.values) { |
| 43 total += subtask.timing; | 43 total += subtask.timing; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 int getSubtaskTime(String subtask) => _subtasks[subtask].timing; | 90 int getSubtaskTime(String subtask) => _subtasks[subtask].timing; |
| 91 } | 91 } |
| 92 | 92 |
| 93 class GenericTask extends CompilerTask { | 93 class GenericTask extends CompilerTask { |
| 94 final String name; | 94 final String name; |
| 95 | 95 |
| 96 GenericTask(this.name, Compiler compiler) | 96 GenericTask(this.name, Compiler compiler) |
| 97 : super(compiler); | 97 : super(compiler); |
| 98 } | 98 } |
| OLD | NEW |