| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 instrumentation; | 5 library instrumentation; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/task/model.dart'; |
| 10 |
| 9 /** | 11 /** |
| 10 * A container with analysis performance constants. | 12 * A container with analysis performance constants. |
| 11 */ | 13 */ |
| 12 class AnalysisPerformanceKind { | 14 class AnalysisPerformanceKind { |
| 13 static const String FULL = 'analysis_full'; | 15 static const String FULL = 'analysis_full'; |
| 14 static const String INCREMENTAL = 'analysis_incremental'; | 16 static const String INCREMENTAL = 'analysis_incremental'; |
| 15 } | 17 } |
| 16 | 18 |
| 17 /** | 19 /** |
| 18 * The interface used by client code to communicate with an instrumentation | 20 * The interface used by client code to communicate with an instrumentation |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * non-`null` server (and hence instrumentation is active). | 93 * non-`null` server (and hence instrumentation is active). |
| 92 */ | 94 */ |
| 93 bool get isActive => _instrumentationServer != null; | 95 bool get isActive => _instrumentationServer != null; |
| 94 | 96 |
| 95 /** | 97 /** |
| 96 * The current time, expressed as a decimal encoded number of milliseconds. | 98 * The current time, expressed as a decimal encoded number of milliseconds. |
| 97 */ | 99 */ |
| 98 String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString(); | 100 String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString(); |
| 99 | 101 |
| 100 /** | 102 /** |
| 101 * Log that an analysis task is being performed in the given [context]. The | 103 * Log that the given analysis [task] is being performed in the given |
| 102 * task has the given [description]. | 104 * [context]. |
| 103 */ | 105 */ |
| 104 void logAnalysisTask(String context, String description) { | 106 void logAnalysisTask(String context, dynamic task) { |
| 107 // TODO(brianwilkerson) When the old task model is removed, change the |
| 108 // parameter type to AnalysisTask. |
| 105 if (_instrumentationServer != null) { | 109 if (_instrumentationServer != null) { |
| 110 String description = |
| 111 (task is AnalysisTask) ? task.description : task.toString(); |
| 106 _instrumentationServer | 112 _instrumentationServer |
| 107 .log(_join([TAG_ANALYSIS_TASK, context, description])); | 113 .log(_join([TAG_ANALYSIS_TASK, context, description])); |
| 108 } | 114 } |
| 109 } | 115 } |
| 110 | 116 |
| 111 /** | 117 /** |
| 112 * Log the fact that an error, described by the given [message], has occurred. | 118 * Log the fact that an error, described by the given [message], has occurred. |
| 113 */ | 119 */ |
| 114 void logError(String message) { | 120 void logError(String message) { |
| 115 _log(TAG_ERROR, message); | 121 _log(TAG_ERROR, message); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 363 } |
| 358 } | 364 } |
| 359 | 365 |
| 360 @override | 366 @override |
| 361 void shutdown() { | 367 void shutdown() { |
| 362 for (InstrumentationServer server in _servers) { | 368 for (InstrumentationServer server in _servers) { |
| 363 server.shutdown(); | 369 server.shutdown(); |
| 364 } | 370 } |
| 365 } | 371 } |
| 366 } | 372 } |
| OLD | NEW |