| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 */ | 91 */ |
| 92 ProcessResult _run(String executable, List<String> arguments) { | 92 ProcessResult _run(String executable, List<String> arguments) { |
| 93 return Process.runSync(executable, arguments, | 93 return Process.runSync(executable, arguments, |
| 94 stderrEncoding: UTF8, stdoutEncoding: UTF8); | 94 stderrEncoding: UTF8, stdoutEncoding: UTF8); |
| 95 } | 95 } |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * 1. Start Analysis Server. | 98 * 1. Start Analysis Server. |
| 99 * 2. Set the analysis [roots]. | 99 * 2. Set the analysis [roots]. |
| 100 * 3. Wait for analysis to complete. | 100 * 3. Wait for analysis to complete. |
| 101 * 4. Record the time to finish analysis. | 101 * 4. Record the heap size after analysis is finished. |
| 102 * 5. Shutdown. | 102 * 5. Shutdown. |
| 103 * 6. Go to (1). | 103 * 6. Go to (1). |
| 104 */ | 104 */ |
| 105 static Future<List<int>> start_waitInitialAnalysis_shutdown( | 105 static Future<List<int>> start_waitInitialAnalysis_shutdown( |
| 106 {List<String> roots, int numOfRepeats}) async { | 106 {List<String> roots, int numOfRepeats}) async { |
| 107 expect(roots, isNotNull, reason: 'roots'); | 107 expect(roots, isNotNull, reason: 'roots'); |
| 108 expect(numOfRepeats, isNotNull, reason: 'numOfRepeats'); | 108 expect(numOfRepeats, isNotNull, reason: 'numOfRepeats'); |
| 109 // Repeat. | 109 // Repeat. |
| 110 List<int> sizes = <int>[]; | 110 List<int> sizes = <int>[]; |
| 111 for (int i = 0; i < numOfRepeats; i++) { | 111 for (int i = 0; i < numOfRepeats; i++) { |
| 112 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); | 112 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); |
| 113 // Initialize Analysis Server. | 113 // Initialize Analysis Server. |
| 114 await test.setUp(); | 114 await test.setUp(); |
| 115 await test.subscribeToStatusNotifications(); | 115 await test.subscribeToStatusNotifications(); |
| 116 // Set roots and analyze. | 116 // Set roots and analyze. |
| 117 await test.sendAnalysisSetAnalysisRoots(roots, []); | 117 await test.sendAnalysisSetAnalysisRoots(roots, []); |
| 118 await test.analysisFinished; | 118 await test.analysisFinished; |
| 119 sizes.add(test.getMemoryUsage()); | 119 sizes.add(test.getMemoryUsage()); |
| 120 // Stop the server. | 120 // Stop the server. |
| 121 await test.shutdown(); | 121 await test.shutdown(); |
| 122 } | 122 } |
| 123 return sizes; | 123 return sizes; |
| 124 } | 124 } |
| 125 } | 125 } |
| OLD | NEW |