| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 /// Note: MUST be the first field of this class to ensure [wallclock] is | 204 /// Note: MUST be the first field of this class to ensure [wallclock] is |
| 205 /// started before other computations. | 205 /// started before other computations. |
| 206 final Stopwatch wallClock = new Stopwatch()..start(); | 206 final Stopwatch wallClock = new Stopwatch()..start(); |
| 207 | 207 |
| 208 /// Measures gaps between zoned closures due to asynchronicity. | 208 /// Measures gaps between zoned closures due to asynchronicity. |
| 209 final Stopwatch asyncWallClock = new Stopwatch(); | 209 final Stopwatch asyncWallClock = new Stopwatch(); |
| 210 | 210 |
| 211 /// Whether measurement of tasks is enabled. | 211 /// Whether measurement of tasks is enabled. |
| 212 final bool enableTaskMeasurements; | 212 final bool enableTaskMeasurements; |
| 213 | 213 |
| 214 static int _hashCodeGenerator = 197; |
| 215 final int hashCode = _hashCodeGenerator++; |
| 216 |
| 214 Measurer({this.enableTaskMeasurements: false}); | 217 Measurer({this.enableTaskMeasurements: false}); |
| 215 | 218 |
| 216 /// The currently running task, that is, the task whose [Stopwatch] is | 219 /// The currently running task, that is, the task whose [Stopwatch] is |
| 217 /// currently running. | 220 /// currently running. |
| 218 CompilerTask currentTask; | 221 CompilerTask currentTask; |
| 219 | 222 |
| 220 /// The current task which should be charged for asynchronous gaps. | 223 /// The current task which should be charged for asynchronous gaps. |
| 221 CompilerTask currentAsyncTask; | 224 CompilerTask currentAsyncTask; |
| 222 | 225 |
| 223 /// Start counting the total elapsed time since the compiler started. | 226 /// Start counting the total elapsed time since the compiler started. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 240 } | 243 } |
| 241 | 244 |
| 242 /// Call this when the eventloop returns control to us. | 245 /// Call this when the eventloop returns control to us. |
| 243 void stopAsyncWallClock() { | 246 void stopAsyncWallClock() { |
| 244 if (currentAsyncTask != null) { | 247 if (currentAsyncTask != null) { |
| 245 currentAsyncTask._watch.stop(); | 248 currentAsyncTask._watch.stop(); |
| 246 } | 249 } |
| 247 asyncWallClock.stop(); | 250 asyncWallClock.stop(); |
| 248 } | 251 } |
| 249 } | 252 } |
| OLD | NEW |