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'; |
(...skipping 26 matching lines...) Expand all Loading... | |
37 unittestConfiguration.timeout = new Duration(minutes: 20); | 37 unittestConfiguration.timeout = new Duration(minutes: 20); |
38 | 38 |
39 var test; | 39 var test; |
40 | 40 |
41 if (metricNames.isEmpty) { | 41 if (metricNames.isEmpty) { |
42 test = new AnalysisTimingTest(); | 42 test = new AnalysisTimingTest(); |
43 } else { | 43 } else { |
44 test = new SubscriptionTimingTest(); | 44 test = new SubscriptionTimingTest(); |
45 } | 45 } |
46 | 46 |
47 Future.wait([test.test_timing()]); | 47 Future.wait(<Future>[test.test_timing()]); |
Jennifer Messerly
2016/09/15 21:00:33
maybe put a type on "var test" above? Then it woul
Brian Wilkerson
2016/09/15 21:37:26
The superclass of those two classes doesn't define
| |
48 } | 48 } |
49 | 49 |
50 const DEFAULT_METRIC = 'analysis'; | 50 const DEFAULT_METRIC = 'analysis'; |
51 const METRIC_NAME_OPTION = 'metric'; | 51 const METRIC_NAME_OPTION = 'metric'; |
52 const PRIORITY_FILE_OPTION = 'priority'; | 52 const PRIORITY_FILE_OPTION = 'priority'; |
53 const SOURCE_OPTION = 'source'; | 53 const SOURCE_OPTION = 'source'; |
54 | 54 |
55 final metricNames = <String>[]; | 55 final metricNames = <String>[]; |
56 String priorityFile; | 56 String priorityFile; |
57 String source; | 57 String source; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 * SubscriptionTimingTest measures the time taken by the analysis server to retu rn | 96 * SubscriptionTimingTest measures the time taken by the analysis server to retu rn |
97 * information for navigation, semantic highlighting, outline, get occurances, | 97 * information for navigation, semantic highlighting, outline, get occurances, |
98 * overrides, folding and implemented. These timings are wrt to the specified pr iority file | 98 * overrides, folding and implemented. These timings are wrt to the specified pr iority file |
99 * - the file that is currently opened and has focus in the editor. Measure the time from | 99 * - the file that is currently opened and has focus in the editor. Measure the time from |
100 * when the client subscribes for the notifications till there is a response fro m the server. | 100 * when the client subscribes for the notifications till there is a response fro m the server. |
101 * Does not wait for analysis to be complete before subscribing for notification s. | 101 * Does not wait for analysis to be complete before subscribing for notification s. |
102 */ | 102 */ |
103 class SubscriptionTimingTest extends AbstractTimingTest { | 103 class SubscriptionTimingTest extends AbstractTimingTest { |
104 List<Metric> _metrics; | 104 List<Metric> _metrics; |
105 | 105 |
106 List<Metric> get metrics => | 106 List<Metric> get metrics => _metrics ??= |
107 _metrics ??= metricNames.map((name) => getMetric(name)).toList(); | 107 new List<Metric>.from(metricNames.map((name) => getMetric(name))); |
Jennifer Messerly
2016/09/15 21:00:33
any idea what happened here? it doesn't look like
Brian Wilkerson
2016/09/15 21:37:26
Nope. I tried to reproduce the error and couldn't,
| |
108 | 108 |
109 Metric getMetric(String name) { | 109 Metric getMetric(String name) { |
110 switch (name) { | 110 switch (name) { |
111 case 'folding': | 111 case 'folding': |
112 return new Metric(name, AnalysisService.FOLDING, onAnalysisFolding); | 112 return new Metric(name, AnalysisService.FOLDING, onAnalysisFolding); |
113 case 'highlighting': | 113 case 'highlighting': |
114 return new Metric( | 114 return new Metric( |
115 name, AnalysisService.HIGHLIGHTS, onAnalysisHighlights); | 115 name, AnalysisService.HIGHLIGHTS, onAnalysisHighlights); |
116 case 'implemented': | 116 case 'implemented': |
117 return new Metric( | 117 return new Metric( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 | 158 |
159 sendAnalysisSetPriorityFiles([priorityFile]); | 159 sendAnalysisSetPriorityFiles([priorityFile]); |
160 | 160 |
161 await analysisFinished; | 161 await analysisFinished; |
162 print('analysis completed in ${stopwatch.elapsed}'); | 162 print('analysis completed in ${stopwatch.elapsed}'); |
163 metrics.forEach((Metric m) => print('${m.name} timings: ${m.timings}')); | 163 metrics.forEach((Metric m) => print('${m.name} timings: ${m.timings}')); |
164 | 164 |
165 await shutdown(); | 165 await shutdown(); |
166 } | 166 } |
167 } | 167 } |
OLD | NEW |