OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:analysis_server/src/protocol_server.dart'; | 8 import 'package:analysis_server/src/protocol_server.dart'; |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
11 import '../../test/integration/support/integration_tests.dart'; | 11 import '../../test/integration/support/integration_tests.dart'; |
12 import '../benchmarks.dart'; | 12 import '../benchmarks.dart'; |
13 import 'memory_tests.dart'; | 13 import 'memory_tests.dart'; |
14 | 14 |
15 /// benchmarks: | 15 /// benchmarks: |
16 /// - analysis-server-cold-analysis | 16 /// - analysis-server-cold-analysis |
17 /// - analysis-server-cold-memory | 17 /// - analysis-server-cold-memory |
18 class ColdAnalysisBenchmark extends Benchmark { | 18 class ColdAnalysisBenchmark extends Benchmark { |
19 ColdAnalysisBenchmark() | 19 ColdAnalysisBenchmark() |
20 : super( | 20 : super( |
21 'analysis-server-cold', | 21 'analysis-server-cold', |
22 'Analysis server benchmarks of a large project on start-up, no ' | 22 'Analysis server benchmarks of a large project on start-up, no ' |
23 'existing driver cache.', | 23 'existing driver cache.', |
24 ); | 24 kind: 'group'); |
25 | 25 |
26 int get maxIterations => 3; | 26 int get maxIterations => 3; |
27 | 27 |
28 @override | 28 @override |
29 Future<BenchMarkResult> run({bool quick: false}) async { | 29 Future<BenchMarkResult> run({bool quick: false}) async { |
30 deleteServerCache(); | 30 if (!quick) { |
| 31 deleteServerCache(); |
| 32 } |
31 | 33 |
32 Stopwatch stopwatch = new Stopwatch()..start(); | 34 Stopwatch stopwatch = new Stopwatch()..start(); |
33 | 35 |
34 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); | 36 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); |
35 await test.setUp(); | 37 await test.setUp(); |
36 await test.subscribeToStatusNotifications(); | 38 await test.subscribeToStatusNotifications(); |
37 await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []); | 39 await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []); |
38 await test.analysisFinished; | 40 await test.analysisFinished; |
39 | 41 |
40 stopwatch.stop(); | 42 stopwatch.stop(); |
(...skipping 11 matching lines...) Expand all Loading... |
52 } | 54 } |
53 | 55 |
54 /// benchmarks: | 56 /// benchmarks: |
55 /// - analysis-server-warm-analysis | 57 /// - analysis-server-warm-analysis |
56 /// - analysis-server-warm-memory | 58 /// - analysis-server-warm-memory |
57 /// - analysis-server-edit | 59 /// - analysis-server-edit |
58 /// - analysis-server-completion | 60 /// - analysis-server-completion |
59 class AnalysisBenchmark extends Benchmark { | 61 class AnalysisBenchmark extends Benchmark { |
60 AnalysisBenchmark() | 62 AnalysisBenchmark() |
61 : super( | 63 : super( |
62 'analysis-server', | 64 'analysis-server', |
63 'Analysis server benchmarks of a large project, with an existing ' | 65 'Analysis server benchmarks of a large project, with an existing ' |
64 'driver cache.', | 66 'driver cache.', |
65 ); | 67 kind: 'group'); |
66 | 68 |
67 @override | 69 @override |
68 Future<BenchMarkResult> run({bool quick: false}) async { | 70 Future<BenchMarkResult> run({bool quick: false}) async { |
69 Stopwatch stopwatch = new Stopwatch()..start(); | 71 Stopwatch stopwatch = new Stopwatch()..start(); |
70 | 72 |
71 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); | 73 AnalysisServerMemoryUsageTest test = new AnalysisServerMemoryUsageTest(); |
72 await test.setUp(); | 74 await test.setUp(); |
73 await test.subscribeToStatusNotifications(); | 75 await test.subscribeToStatusNotifications(); |
74 await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []); | 76 await test.sendAnalysisSetAnalysisRoots(getProjectRoots(quick: quick), []); |
75 await test.analysisFinished; | 77 await test.analysisFinished; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 await test.sendAnalysisUpdateContent( | 176 await test.sendAnalysisUpdateContent( |
175 {filePath: new AddContentOverlay(contents)}); | 177 {filePath: new AddContentOverlay(contents)}); |
176 } | 178 } |
177 } | 179 } |
178 | 180 |
179 stopwatch.stop(); | 181 stopwatch.stop(); |
180 | 182 |
181 return stopwatch.elapsedMicroseconds ~/ completionCount; | 183 return stopwatch.elapsedMicroseconds ~/ completionCount; |
182 } | 184 } |
183 } | 185 } |
OLD | NEW |