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

Side by Side Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 1163713005: analysis server performance measurement driver first cut (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/performance/driver.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 test.integration.analysis; 5 library test.integration.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 * test. 421 * test.
422 */ 422 */
423 bool _receivedBadDataFromServer = false; 423 bool _receivedBadDataFromServer = false;
424 424
425 /** 425 /**
426 * Stopwatch that we use to generate timing information for debug output. 426 * Stopwatch that we use to generate timing information for debug output.
427 */ 427 */
428 Stopwatch _time = new Stopwatch(); 428 Stopwatch _time = new Stopwatch();
429 429
430 /** 430 /**
431 * The [currentElapseTime] at which the last communication was received from t he server
432 * or `null` if no communication has been received.
433 */
434 double lastCommunicationTime;
435
436 /**
437 * The current elapse time (seconds) since the server was started.
438 */
439 double get currentElapseTime => _time.elapsedTicks / _time.frequency;
440
441 /**
431 * Future that completes when the server process exits. 442 * Future that completes when the server process exits.
432 */ 443 */
433 Future<int> get exitCode => _process.exitCode; 444 Future<int> get exitCode => _process.exitCode;
434 445
435 /** 446 /**
436 * Print out any messages exchanged with the server. If some messages have 447 * Print out any messages exchanged with the server. If some messages have
437 * already been exchanged with the server, they are printed out immediately. 448 * already been exchanged with the server, they are printed out immediately.
438 */ 449 */
439 void debugStdio() { 450 void debugStdio() {
440 if (_debuggingStdio) { 451 if (_debuggingStdio) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 492
482 /** 493 /**
483 * Start listening to output from the server, and deliver notifications to 494 * Start listening to output from the server, and deliver notifications to
484 * [notificationProcessor]. 495 * [notificationProcessor].
485 */ 496 */
486 void listenToOutput(NotificationProcessor notificationProcessor) { 497 void listenToOutput(NotificationProcessor notificationProcessor) {
487 _process.stdout 498 _process.stdout
488 .transform((new Utf8Codec()).decoder) 499 .transform((new Utf8Codec()).decoder)
489 .transform(new LineSplitter()) 500 .transform(new LineSplitter())
490 .listen((String line) { 501 .listen((String line) {
502 lastCommunicationTime = currentElapseTime;
491 String trimmedLine = line.trim(); 503 String trimmedLine = line.trim();
492 _recordStdio('RECV: $trimmedLine'); 504 _recordStdio('RECV: $trimmedLine');
493 var message; 505 var message;
494 try { 506 try {
495 message = JSON.decoder.convert(trimmedLine); 507 message = JSON.decoder.convert(trimmedLine);
496 } catch (exception) { 508 } catch (exception) {
497 _badDataFromServer(); 509 _badDataFromServer();
498 return; 510 return;
499 } 511 }
500 expect(message, isMap); 512 expect(message, isMap);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 new Future.delayed(new Duration(seconds: 1), expectAsync(() { 635 new Future.delayed(new Duration(seconds: 1), expectAsync(() {
624 fail('Bad data received from server'); 636 fail('Bad data received from server');
625 })); 637 }));
626 } 638 }
627 639
628 /** 640 /**
629 * Record a message that was exchanged with the server, and print it out if 641 * Record a message that was exchanged with the server, and print it out if
630 * [debugStdio] has been called. 642 * [debugStdio] has been called.
631 */ 643 */
632 void _recordStdio(String line) { 644 void _recordStdio(String line) {
633 double elapsedTime = _time.elapsedTicks / _time.frequency; 645 double elapsedTime = currentElapseTime;
634 line = "$elapsedTime: $line"; 646 line = "$elapsedTime: $line";
635 if (_debuggingStdio) { 647 if (_debuggingStdio) {
636 print(line); 648 print(line);
637 } 649 }
638 _recordedStdio.add(line); 650 _recordedStdio.add(line);
639 } 651 }
640 } 652 }
641 653
642 /** 654 /**
643 * Matcher that matches a list of objects, each of which satisfies the given 655 * Matcher that matches a list of objects, each of which satisfies the given
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 void populateMismatches(item, List<MismatchDescriber> mismatches); 856 void populateMismatches(item, List<MismatchDescriber> mismatches);
845 857
846 /** 858 /**
847 * Create a [MismatchDescriber] describing a mismatch with a simple string. 859 * Create a [MismatchDescriber] describing a mismatch with a simple string.
848 */ 860 */
849 MismatchDescriber simpleDescription(String description) => 861 MismatchDescriber simpleDescription(String description) =>
850 (Description mismatchDescription) { 862 (Description mismatchDescription) {
851 mismatchDescription.add(description); 863 mismatchDescription.add(description);
852 }; 864 };
853 } 865 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/performance/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698