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

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

Issue 874083002: add periodic delay in analysis to reduce request processing latency (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add flag to disable delay along with comments explaining why the workaround was added Created 5 years, 11 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/lib/src/get_handler.dart ('k') | no next file » | 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 driver; 5 library driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math'; 9 import 'dart:math';
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 */ 101 */
102 static const String HELP_OPTION = "help"; 102 static const String HELP_OPTION = "help";
103 103
104 /** 104 /**
105 * The name of the option used to specify if [print] should print to the 105 * The name of the option used to specify if [print] should print to the
106 * console instead of being intercepted. 106 * console instead of being intercepted.
107 */ 107 */
108 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; 108 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console";
109 109
110 /** 110 /**
111 * The name of the option used to specify if [print] should print to the
112 * console instead of being intercepted.
113 */
114 static const String INTERNAL_DELAY_FREQUENCY = 'internal-delay-freqency';
115
116 /**
111 * The name of the option used to specify the port to which the server will 117 * The name of the option used to specify the port to which the server will
112 * connect. 118 * connect.
113 */ 119 */
114 static const String PORT_OPTION = "port"; 120 static const String PORT_OPTION = "port";
115 121
116 /** 122 /**
117 * The path to the SDK. 123 * The path to the SDK.
118 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is 124 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is
119 * operational. 125 * operational.
120 */ 126 */
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // } 183 // }
178 // } else { 184 // } else {
179 // if (instrumentationServer != null) { 185 // if (instrumentationServer != null) {
180 // print('Exiting server: providing an instrumentation server without ena bling instrumentation'); 186 // print('Exiting server: providing an instrumentation server without ena bling instrumentation');
181 // print(''); 187 // print('');
182 // _printUsage(parser); 188 // _printUsage(parser);
183 // return; 189 // return;
184 // } 190 // }
185 // } 191 // }
186 192
193 // TODO (danrubel) Remove this workaround
194 // once the underlying VM and dart:io issue has been fixed.
195 if (results[INTERNAL_DELAY_FREQUENCY] != null) {
196 AnalysisServer.performOperationDelayFreqency =
197 int.parse(results[INTERNAL_DELAY_FREQUENCY], onError: (_) => 0);
198 }
199
187 int port; 200 int port;
188 bool serve_http = false; 201 bool serve_http = false;
189 if (results[PORT_OPTION] != null) { 202 if (results[PORT_OPTION] != null) {
190 serve_http = true; 203 serve_http = true;
191 try { 204 try {
192 port = int.parse(results[PORT_OPTION]); 205 port = int.parse(results[PORT_OPTION]);
193 } on FormatException { 206 } on FormatException {
194 print('Invalid port number: ${results[PORT_OPTION]}'); 207 print('Invalid port number: ${results[PORT_OPTION]}');
195 print(''); 208 print('');
196 _printUsage(parser); 209 _printUsage(parser);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 defaultsTo: false, 333 defaultsTo: false,
321 negatable: false); 334 negatable: false);
322 parser.addFlag( 335 parser.addFlag(
323 INTERNAL_PRINT_TO_CONSOLE, 336 INTERNAL_PRINT_TO_CONSOLE,
324 help: "enable sending `print` output to the console", 337 help: "enable sending `print` output to the console",
325 defaultsTo: false, 338 defaultsTo: false,
326 negatable: false); 339 negatable: false);
327 parser.addOption( 340 parser.addOption(
328 PORT_OPTION, 341 PORT_OPTION,
329 help: "[port] the port on which the server will listen"); 342 help: "[port] the port on which the server will listen");
343 parser.addOption(INTERNAL_DELAY_FREQUENCY);
330 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); 344 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk");
331 parser.addFlag( 345 parser.addFlag(
332 NO_ERROR_NOTIFICATION, 346 NO_ERROR_NOTIFICATION,
333 help: "disable sending all analysis error notifications to the server", 347 help: "disable sending all analysis error notifications to the server",
334 defaultsTo: false, 348 defaultsTo: false,
335 negatable: false); 349 negatable: false);
336 parser.addOption( 350 parser.addOption(
337 FILE_READ_MODE, 351 FILE_READ_MODE,
338 help: "an option of the ways files can be read from disk, " + 352 help: "an option of the ways files can be read from disk, " +
339 "some clients normalize end of line characters which would make " + 353 "some clients normalize end of line characters which would make " +
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 uuidFile.parent.createSync(recursive: true); 396 uuidFile.parent.createSync(recursive: true);
383 uuidFile.writeAsStringSync(uuid); 397 uuidFile.writeAsStringSync(uuid);
384 } catch (exception, stackTrace) { 398 } catch (exception, stackTrace) {
385 service.logPriorityException(exception, stackTrace); 399 service.logPriorityException(exception, stackTrace);
386 // Slightly alter the uuid to indicate it was not persisted 400 // Slightly alter the uuid to indicate it was not persisted
387 uuid = 'temp-$uuid'; 401 uuid = 'temp-$uuid';
388 } 402 }
389 return uuid; 403 return uuid;
390 } 404 }
391 } 405 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698