| 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 import 'dart:math'; |
| 8 | 9 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 11 | 12 |
| 12 import '../../test/integration/integration_tests.dart'; | 13 import '../../test/integration/integration_tests.dart'; |
| 13 | 14 |
| 14 void printMemoryResults(String id, String description, List<int> sizes) { | 15 void printMemoryResults(String id, String description, List<int> sizes) { |
| 16 int minMemory = sizes.fold(sizes.first, min); |
| 17 int maxMemory = sizes.fold(sizes.first, max); |
| 15 String now = new DateTime.now().toUtc().toIso8601String(); | 18 String now = new DateTime.now().toUtc().toIso8601String(); |
| 16 print('$now ========== $id'); | 19 print('$now ========== $id'); |
| 17 print('memory: $sizes'); | 20 print('memory: $sizes'); |
| 21 print('min_memory: $minMemory'); |
| 22 print('max_memory: $maxMemory'); |
| 18 print(description.trim()); | 23 print(description.trim()); |
| 19 print('--------------------'); | 24 print('--------------------'); |
| 20 print(''); | 25 print(''); |
| 21 print(''); | 26 print(''); |
| 22 } | 27 } |
| 23 | 28 |
| 24 /** | 29 /** |
| 25 * Base class for analysis server memory usage tests. | 30 * Base class for analysis server memory usage tests. |
| 26 */ | 31 */ |
| 27 class AnalysisServerMemoryUsageTest | 32 class AnalysisServerMemoryUsageTest |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Set roots and analyze. | 121 // Set roots and analyze. |
| 117 await test.sendAnalysisSetAnalysisRoots(roots, []); | 122 await test.sendAnalysisSetAnalysisRoots(roots, []); |
| 118 await test.analysisFinished; | 123 await test.analysisFinished; |
| 119 sizes.add(test.getMemoryUsage()); | 124 sizes.add(test.getMemoryUsage()); |
| 120 // Stop the server. | 125 // Stop the server. |
| 121 await test.shutdown(); | 126 await test.shutdown(); |
| 122 } | 127 } |
| 123 return sizes; | 128 return sizes; |
| 124 } | 129 } |
| 125 } | 130 } |
| OLD | NEW |