Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 943723002: Return version with connected notification (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Touched missed Java files Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 /** 62 /**
63 * Instances of the class [AnalysisServer] implement a server that listens on a 63 * Instances of the class [AnalysisServer] implement a server that listens on a
64 * [CommunicationChannel] for analysis requests and process them. 64 * [CommunicationChannel] for analysis requests and process them.
65 */ 65 */
66 class AnalysisServer { 66 class AnalysisServer {
67 /** 67 /**
68 * The version of the analysis server. The value should be replaced 68 * The version of the analysis server. The value should be replaced
69 * automatically during the build. 69 * automatically during the build.
70 */ 70 */
71 static final String VERSION = '1.1.0'; 71 static final String VERSION = '1.3.0';
72 72
73 /** 73 /**
74 * The number of milliseconds to perform operations before inserting 74 * The number of milliseconds to perform operations before inserting
75 * a 1 millisecond delay so that the VM and dart:io can deliver content 75 * a 1 millisecond delay so that the VM and dart:io can deliver content
76 * to stdin. This should be removed once the underlying problem is fixed. 76 * to stdin. This should be removed once the underlying problem is fixed.
77 */ 77 */
78 static int performOperationDelayFreqency = 25; 78 static int performOperationDelayFreqency = 25;
79 79
80 /** 80 /**
81 * The channel from which requests are received and to which responses should 81 * The channel from which requests are received and to which responses should
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 _onFileAnalyzedController = new StreamController.broadcast(); 262 _onFileAnalyzedController = new StreamController.broadcast();
263 _onPriorityChangeController = 263 _onPriorityChangeController =
264 new StreamController<PriorityChangeEvent>.broadcast(); 264 new StreamController<PriorityChangeEvent>.broadcast();
265 running = true; 265 running = true;
266 onAnalysisStarted.first.then((_) { 266 onAnalysisStarted.first.then((_) {
267 onAnalysisComplete.then((_) { 267 onAnalysisComplete.then((_) {
268 performanceAfterStartup = new ServerPerformance(); 268 performanceAfterStartup = new ServerPerformance();
269 _performance = performanceAfterStartup; 269 _performance = performanceAfterStartup;
270 }); 270 });
271 }); 271 });
272 Notification notification = new ServerConnectedParams().toNotification(); 272 Notification notification =
273 new ServerConnectedParams(VERSION).toNotification();
273 channel.sendNotification(notification); 274 channel.sendNotification(notification);
274 channel.listen(handleRequest, onDone: done, onError: error); 275 channel.listen(handleRequest, onDone: done, onError: error);
275 } 276 }
276 277
277 /** 278 /**
278 * The [Future] that completes when analysis is complete. 279 * The [Future] that completes when analysis is complete.
279 */ 280 */
280 Future get onAnalysisComplete { 281 Future get onAnalysisComplete {
281 if (isAnalysisComplete()) { 282 if (isAnalysisComplete()) {
282 return new Future.value(); 283 return new Future.value();
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 UriResolver resourceResolver = new ResourceUriResolver(resourceProvider); 1246 UriResolver resourceResolver = new ResourceUriResolver(resourceProvider);
1246 List<UriResolver> resolvers = packageUriResolver != null ? 1247 List<UriResolver> resolvers = packageUriResolver != null ?
1247 <UriResolver>[dartResolver, packageUriResolver, resourceResolver] : 1248 <UriResolver>[dartResolver, packageUriResolver, resourceResolver] :
1248 <UriResolver>[dartResolver, resourceResolver]; 1249 <UriResolver>[dartResolver, resourceResolver];
1249 return new SourceFactory(resolvers); 1250 return new SourceFactory(resolvers);
1250 } 1251 }
1251 } 1252 }
1252 1253
1253 1254
1254 /** 1255 /**
1255 * Container with global [AnalysisServer] performance statistics.
1256 */
1257 class ServerPerformanceStatistics {
1258 /**
1259 * The [PerformanceTag] for time spent in
1260 * PerformAnalysisOperation._updateIndex.
1261 */
1262 static PerformanceTag index = new PerformanceTag('index');
1263
1264 /**
1265 * The [PerformanceTag] for time spent in
1266 * PerformAnalysisOperation._sendNotices.
1267 */
1268 static PerformanceTag notices = new PerformanceTag('notices');
1269
1270 /**
1271 * The [PerformanceTag] for time spent performing a _DartIndexOperation.
1272 */
1273 static PerformanceTag indexOperation = new PerformanceTag('indexOperation');
1274
1275 /**
1276 * The [PerformanceTag] for time spent between calls to
1277 * AnalysisServer.performOperation when the server is not idle.
1278 */
1279 static PerformanceTag intertask = new PerformanceTag('intertask');
1280
1281 /**
1282 * The [PerformanceTag] for time spent between calls to
1283 * AnalysisServer.performOperation when the server is idle.
1284 */
1285 static PerformanceTag idle = new PerformanceTag('idle');
1286 }
1287
1288
1289 /**
1290 * A class used by [AnalysisServer] to record performance information 1256 * A class used by [AnalysisServer] to record performance information
1291 * such as request latency. 1257 * such as request latency.
1292 */ 1258 */
1293 class ServerPerformance { 1259 class ServerPerformance {
1294 1260
1295 /** 1261 /**
1296 * The creation time and the time when performance information 1262 * The creation time and the time when performance information
1297 * started to be recorded here. 1263 * started to be recorded here.
1298 */ 1264 */
1299 int startTime = new DateTime.now().millisecondsSinceEpoch; 1265 int startTime = new DateTime.now().millisecondsSinceEpoch;
(...skipping 28 matching lines...) Expand all
1328 new DateTime.now().millisecondsSinceEpoch - 1294 new DateTime.now().millisecondsSinceEpoch -
1329 request.clientRequestTime; 1295 request.clientRequestTime;
1330 requestLatency += latency; 1296 requestLatency += latency;
1331 maxLatency = max(maxLatency, latency); 1297 maxLatency = max(maxLatency, latency);
1332 if (latency > 150) { 1298 if (latency > 150) {
1333 ++slowRequestCount; 1299 ++slowRequestCount;
1334 } 1300 }
1335 } 1301 }
1336 } 1302 }
1337 } 1303 }
1304
1305
1306 /**
1307 * Container with global [AnalysisServer] performance statistics.
1308 */
1309 class ServerPerformanceStatistics {
1310 /**
1311 * The [PerformanceTag] for time spent in
1312 * PerformAnalysisOperation._updateIndex.
1313 */
1314 static PerformanceTag index = new PerformanceTag('index');
1315
1316 /**
1317 * The [PerformanceTag] for time spent in
1318 * PerformAnalysisOperation._sendNotices.
1319 */
1320 static PerformanceTag notices = new PerformanceTag('notices');
1321
1322 /**
1323 * The [PerformanceTag] for time spent performing a _DartIndexOperation.
1324 */
1325 static PerformanceTag indexOperation = new PerformanceTag('indexOperation');
1326
1327 /**
1328 * The [PerformanceTag] for time spent between calls to
1329 * AnalysisServer.performOperation when the server is not idle.
1330 */
1331 static PerformanceTag intertask = new PerformanceTag('intertask');
1332
1333 /**
1334 * The [PerformanceTag] for time spent between calls to
1335 * AnalysisServer.performOperation when the server is idle.
1336 */
1337 static PerformanceTag idle = new PerformanceTag('idle');
1338 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698