| 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 leg_apiimpl; | 5 library leg_apiimpl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:package_config/packages.dart'; | 10 import 'package:package_config/packages.dart'; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void computeTimings(Duration setupDuration, StringBuffer timings) { | 251 void computeTimings(Duration setupDuration, StringBuffer timings) { |
| 252 timings.writeln("Timings:"); | 252 timings.writeln("Timings:"); |
| 253 Duration totalDuration = measurer.wallClock.elapsed; | 253 Duration totalDuration = measurer.wallClock.elapsed; |
| 254 Duration asyncDuration = measurer.asyncWallClock.elapsed; | 254 Duration asyncDuration = measurer.asyncWallClock.elapsed; |
| 255 Duration cumulatedDuration = Duration.ZERO; | 255 Duration cumulatedDuration = Duration.ZERO; |
| 256 for (final task in tasks) { | 256 for (final task in tasks) { |
| 257 String running = task.isRunning ? "*" : ""; | 257 String running = task.isRunning ? "*" : ""; |
| 258 Duration duration = task.duration; | 258 Duration duration = task.duration; |
| 259 if (duration != Duration.ZERO) { | 259 if (duration != Duration.ZERO) { |
| 260 cumulatedDuration += duration; | 260 cumulatedDuration += duration; |
| 261 timings.writeln( | 261 timings.writeln(' $running${task.name} took' |
| 262 ' $running${task.name} took' | |
| 263 ' ${duration.inMilliseconds}msec'); | 262 ' ${duration.inMilliseconds}msec'); |
| 264 for (String subtask in task.subtasks) { | 263 for (String subtask in task.subtasks) { |
| 265 int subtime = task.getSubtaskTime(subtask); | 264 int subtime = task.getSubtaskTime(subtask); |
| 266 String running = task.getSubtaskIsRunning(subtask) ? "*" : ""; | 265 String running = task.getSubtaskIsRunning(subtask) ? "*" : ""; |
| 267 timings.writeln( | 266 timings.writeln( |
| 268 ' $running${task.name} > $subtask took ${subtime}msec'); | 267 ' $running${task.name} > $subtask took ${subtime}msec'); |
| 269 } | 268 } |
| 270 } | 269 } |
| 271 } | 270 } |
| 272 Duration unaccountedDuration = | 271 Duration unaccountedDuration = |
| 273 totalDuration - cumulatedDuration - setupDuration - asyncDuration; | 272 totalDuration - cumulatedDuration - setupDuration - asyncDuration; |
| 274 double percent = unaccountedDuration.inMilliseconds * 100 | 273 double percent = |
| 275 / totalDuration.inMilliseconds; | 274 unaccountedDuration.inMilliseconds * 100 / totalDuration.inMilliseconds; |
| 276 timings.write( | 275 timings.write(' Total compile-time ${totalDuration.inMilliseconds}msec;' |
| 277 ' Total compile-time ${totalDuration.inMilliseconds}msec;' | |
| 278 ' setup ${setupDuration.inMilliseconds}msec;' | 276 ' setup ${setupDuration.inMilliseconds}msec;' |
| 279 ' async ${asyncDuration.inMilliseconds}msec;' | 277 ' async ${asyncDuration.inMilliseconds}msec;' |
| 280 ' unaccounted ${unaccountedDuration.inMilliseconds}msec' | 278 ' unaccounted ${unaccountedDuration.inMilliseconds}msec' |
| 281 ' (${percent.toStringAsFixed(2)}%)'); | 279 ' (${percent.toStringAsFixed(2)}%)'); |
| 282 } | 280 } |
| 283 | 281 |
| 284 void reportDiagnostic(DiagnosticMessage message, | 282 void reportDiagnostic(DiagnosticMessage message, |
| 285 List<DiagnosticMessage> infos, api.Diagnostic kind) { | 283 List<DiagnosticMessage> infos, api.Diagnostic kind) { |
| 286 _reportDiagnosticMessage(message, kind); | 284 _reportDiagnosticMessage(message, kind); |
| 287 for (DiagnosticMessage info in infos) { | 285 for (DiagnosticMessage info in infos) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 377 } |
| 380 } | 378 } |
| 381 | 379 |
| 382 /// For every 'dart:' library, a corresponding environment variable is set | 380 /// For every 'dart:' library, a corresponding environment variable is set |
| 383 /// to "true". The environment variable's name is the concatenation of | 381 /// to "true". The environment variable's name is the concatenation of |
| 384 /// this prefix and the name (without the 'dart:'. | 382 /// this prefix and the name (without the 'dart:'. |
| 385 /// | 383 /// |
| 386 /// For example 'dart:html' has the environment variable 'dart.library.html' set | 384 /// For example 'dart:html' has the environment variable 'dart.library.html' set |
| 387 /// to "true". | 385 /// to "true". |
| 388 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; | 386 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; |
| OLD | NEW |