| 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:async' | 7 import 'dart:async' |
| 8 show Future, Zone, ZoneDelegate, ZoneSpecification, runZoned; | 8 show Future, Zone, ZoneDelegate, ZoneSpecification, runZoned; |
| 9 | 9 |
| 10 /// Used to measure where time is spent in the compiler. | 10 /// Used to measure where time is spent in the compiler. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 GenericTask subtask = | 181 GenericTask subtask = |
| 182 _subtasks.putIfAbsent(name, () => new GenericTask(name, measurer)); | 182 _subtasks.putIfAbsent(name, () => new GenericTask(name, measurer)); |
| 183 return subtask.measure(action); | 183 return subtask.measure(action); |
| 184 } | 184 } |
| 185 | 185 |
| 186 Iterable<String> get subtasks => _subtasks.keys; | 186 Iterable<String> get subtasks => _subtasks.keys; |
| 187 | 187 |
| 188 int getSubtaskTime(String subtask) => _subtasks[subtask].timing; | 188 int getSubtaskTime(String subtask) => _subtasks[subtask].timing; |
| 189 | 189 |
| 190 bool getSubtaskIsRunning(String subtask) => _subtasks[subtask].isRunning; | 190 bool getSubtaskIsRunning(String subtask) => _subtasks[subtask].isRunning; |
| 191 | |
| 192 /// Used by the dart2js_incremental to provide measurements on each | |
| 193 /// incremental compile. | |
| 194 clearMeasurements() { | |
| 195 if (_isDisabled) return; | |
| 196 _watch.reset(); | |
| 197 _subtasks.values.forEach((s) => s.clearMeasurements()); | |
| 198 } | |
| 199 } | 191 } |
| 200 | 192 |
| 201 class GenericTask extends CompilerTask { | 193 class GenericTask extends CompilerTask { |
| 202 final String name; | 194 final String name; |
| 203 GenericTask(this.name, Measurer measurer) : super(measurer); | 195 GenericTask(this.name, Measurer measurer) : super(measurer); |
| 204 } | 196 } |
| 205 | 197 |
| 206 class Measurer { | 198 class Measurer { |
| 207 /// Measures the total runtime from this object was constructed. | 199 /// Measures the total runtime from this object was constructed. |
| 208 /// | 200 /// |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 240 } |
| 249 | 241 |
| 250 /// Call this when the eventloop returns control to us. | 242 /// Call this when the eventloop returns control to us. |
| 251 void stopAsyncWallClock() { | 243 void stopAsyncWallClock() { |
| 252 if (currentAsyncTask != null) { | 244 if (currentAsyncTask != null) { |
| 253 currentAsyncTask._watch.stop(); | 245 currentAsyncTask._watch.stop(); |
| 254 } | 246 } |
| 255 asyncWallClock.stop(); | 247 asyncWallClock.stop(); |
| 256 } | 248 } |
| 257 } | 249 } |
| OLD | NEW |