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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:core'; | 7 import 'dart:core'; |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
10 | 10 |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 contextAnalysisDoneCompleters[context] = completer; | 1085 contextAnalysisDoneCompleters[context] = completer; |
1086 } | 1086 } |
1087 return completer.future; | 1087 return completer.future; |
1088 } | 1088 } |
1089 | 1089 |
1090 /** | 1090 /** |
1091 * Perform the next available [ServerOperation]. | 1091 * Perform the next available [ServerOperation]. |
1092 */ | 1092 */ |
1093 void performOperation() { | 1093 void performOperation() { |
1094 assert(performOperationPending); | 1094 assert(performOperationPending); |
1095 PerformanceTag.UNKNOWN.makeCurrent(); | 1095 PerformanceTag.unknown.makeCurrent(); |
1096 performOperationPending = false; | 1096 performOperationPending = false; |
1097 if (!running) { | 1097 if (!running) { |
1098 // An error has occurred, or the connection to the client has been | 1098 // An error has occurred, or the connection to the client has been |
1099 // closed, since this method was scheduled on the event queue. So | 1099 // closed, since this method was scheduled on the event queue. So |
1100 // don't do anything. Instead clear the operation queue. | 1100 // don't do anything. Instead clear the operation queue. |
1101 operationQueue.clear(); | 1101 operationQueue.clear(); |
1102 return; | 1102 return; |
1103 } | 1103 } |
1104 // prepare next operation | 1104 // prepare next operation |
1105 ServerOperation operation = operationQueue.take(); | 1105 ServerOperation operation = operationQueue.take(); |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 } | 2336 } |
2337 } | 2337 } |
2338 } | 2338 } |
2339 } | 2339 } |
2340 | 2340 |
2341 /** | 2341 /** |
2342 * Container with global [AnalysisServer] performance statistics. | 2342 * Container with global [AnalysisServer] performance statistics. |
2343 */ | 2343 */ |
2344 class ServerPerformanceStatistics { | 2344 class ServerPerformanceStatistics { |
2345 /** | 2345 /** |
| 2346 * The [PerformanceTag] for `package:analysis_server`. |
| 2347 */ |
| 2348 static PerformanceTag server = new PerformanceTag('server'); |
| 2349 |
| 2350 /** |
2346 * The [PerformanceTag] for time spent in [ExecutionDomainHandler]. | 2351 * The [PerformanceTag] for time spent in [ExecutionDomainHandler]. |
2347 */ | 2352 */ |
2348 static PerformanceTag executionNotifications = | 2353 static PerformanceTag executionNotifications = |
2349 new PerformanceTag('executionNotifications'); | 2354 new PerformanceTag('executionNotifications'); |
2350 | 2355 |
2351 /** | 2356 /** |
2352 * The [PerformanceTag] for time spent performing a _DartIndexOperation. | 2357 * The [PerformanceTag] for time spent performing a _DartIndexOperation. |
2353 */ | 2358 */ |
2354 static PerformanceTag indexOperation = new PerformanceTag('indexOperation'); | 2359 static PerformanceTag indexOperation = new PerformanceTag('indexOperation'); |
2355 | 2360 |
2356 /** | 2361 /** |
2357 * The [PerformanceTag] for time spent between calls to | 2362 * The [PerformanceTag] for time spent between calls to |
2358 * AnalysisServer.performOperation when the server is not idle. | 2363 * AnalysisServer.performOperation when the server is not idle. |
2359 */ | 2364 */ |
2360 static PerformanceTag intertask = new PerformanceTag('intertask'); | 2365 static PerformanceTag intertask = new PerformanceTag('intertask'); |
2361 | 2366 |
2362 /** | 2367 /** |
2363 * The [PerformanceTag] for time spent between calls to | 2368 * The [PerformanceTag] for time spent between calls to |
2364 * AnalysisServer.performOperation when the server is idle. | 2369 * AnalysisServer.performOperation when the server is idle. |
2365 */ | 2370 */ |
2366 static PerformanceTag idle = new PerformanceTag('idle'); | 2371 static PerformanceTag idle = new PerformanceTag('idle'); |
2367 | 2372 |
2368 /** | 2373 /** |
2369 * The [PerformanceTag] for time spent in | 2374 * The [PerformanceTag] for time spent in |
2370 * PerformAnalysisOperation._sendNotices. | 2375 * PerformAnalysisOperation._sendNotices. |
2371 */ | 2376 */ |
2372 static PerformanceTag notices = new PerformanceTag('notices'); | 2377 static PerformanceTag notices = server.createChild('notices'); |
2373 | 2378 |
2374 /** | 2379 /** |
2375 * The [PerformanceTag] for time spent running pub. | 2380 * The [PerformanceTag] for time spent running pub. |
2376 */ | 2381 */ |
2377 static PerformanceTag pub = new PerformanceTag('pub'); | 2382 static PerformanceTag pub = server.createChild('pub'); |
2378 | 2383 |
2379 /** | 2384 /** |
2380 * The [PerformanceTag] for time spent in server communication channels. | 2385 * The [PerformanceTag] for time spent in server communication channels. |
2381 */ | 2386 */ |
2382 static PerformanceTag serverChannel = new PerformanceTag('serverChannel'); | 2387 static PerformanceTag serverChannel = server.createChild('channel'); |
2383 | 2388 |
2384 /** | 2389 /** |
2385 * The [PerformanceTag] for time spent in server request handlers. | 2390 * The [PerformanceTag] for time spent in server request handlers. |
2386 */ | 2391 */ |
2387 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2392 static PerformanceTag serverRequests = server.createChild('requests'); |
2388 | 2393 |
2389 /** | 2394 /** |
2390 * The [PerformanceTag] for time spent in split store microtasks. | 2395 * The [PerformanceTag] for time spent in split store microtasks. |
2391 */ | 2396 */ |
2392 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2397 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2393 } | 2398 } |
2394 | 2399 |
2395 /** | 2400 /** |
2396 * Used to record server exceptions. | 2401 * Used to record server exceptions. |
2397 */ | 2402 */ |
2398 class ServerException { | 2403 class ServerException { |
2399 final String message; | 2404 final String message; |
2400 final dynamic exception; | 2405 final dynamic exception; |
2401 final StackTrace stackTrace; | 2406 final StackTrace stackTrace; |
2402 final bool fatal; | 2407 final bool fatal; |
2403 | 2408 |
2404 ServerException(this.message, this.exception, this.stackTrace, this.fatal); | 2409 ServerException(this.message, this.exception, this.stackTrace, this.fatal); |
2405 | 2410 |
2406 @override | 2411 @override |
2407 String toString() => message; | 2412 String toString() => message; |
2408 } | 2413 } |
OLD | NEW |