OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 server.performance.analysis.timing; | 5 library server.performance.analysis.timing; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:test/test.dart'; |
13 | 13 |
14 import '../../test/utils.dart'; | 14 import '../../test/utils.dart'; |
15 import 'performance_tests.dart'; | 15 import 'performance_tests.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * Pass in the directory of the source to be analyzed as option `--source`, | 18 * Pass in the directory of the source to be analyzed as option `--source`, |
19 * optionally specify a priority file with `--priority` and the specific | 19 * optionally specify a priority file with `--priority` and the specific |
20 * test to run with `--metric`. If no test is specified, the default is | 20 * test to run with `--metric`. If no test is specified, the default is |
21 * `analysis`. | 21 * `analysis`. |
22 */ | 22 */ |
23 main(List<String> arguments) { | 23 main(List<String> arguments) { |
24 initializeTestEnvironment(); | 24 initializeTestEnvironment(); |
25 ArgParser parser = _createArgParser(); | 25 ArgParser parser = _createArgParser(); |
26 var args = parser.parse(arguments); | 26 var args = parser.parse(arguments); |
27 if (args[SOURCE_OPTION] == null) { | 27 if (args[SOURCE_OPTION] == null) { |
28 print('path to source directory must be specified'); | 28 print('path to source directory must be specified'); |
29 exit(1); | 29 exit(1); |
30 } | 30 } |
31 source = args[SOURCE_OPTION]; | 31 source = args[SOURCE_OPTION]; |
32 priorityFile = args[PRIORITY_FILE_OPTION]; | 32 priorityFile = args[PRIORITY_FILE_OPTION]; |
33 List names = args[METRIC_NAME_OPTION] as List; | 33 List names = args[METRIC_NAME_OPTION] as List; |
34 for (var name in names) { | 34 for (var name in names) { |
35 metricNames.add(name as String); | 35 metricNames.add(name as String); |
36 } | 36 } |
37 unittestConfiguration.timeout = new Duration(minutes: 20); | |
38 | 37 |
39 var test; | 38 var test; |
40 | 39 |
41 if (metricNames.isEmpty) { | 40 if (metricNames.isEmpty) { |
42 test = new AnalysisTimingTest(); | 41 test = new AnalysisTimingTest(); |
43 } else { | 42 } else { |
44 test = new SubscriptionTimingTest(); | 43 test = new SubscriptionTimingTest(); |
45 } | 44 } |
46 | 45 |
47 Future.wait(<Future>[test.test_timing()]); | 46 Future.wait(<Future>[test.test_timing()]); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 156 |
158 sendAnalysisSetPriorityFiles([priorityFile]); | 157 sendAnalysisSetPriorityFiles([priorityFile]); |
159 | 158 |
160 await analysisFinished; | 159 await analysisFinished; |
161 print('analysis completed in ${stopwatch.elapsed}'); | 160 print('analysis completed in ${stopwatch.elapsed}'); |
162 metrics.forEach((Metric m) => print('${m.name} timings: ${m.timings}')); | 161 metrics.forEach((Metric m) => print('${m.name} timings: ${m.timings}')); |
163 | 162 |
164 await shutdown(); | 163 await shutdown(); |
165 } | 164 } |
166 } | 165 } |
OLD | NEW |