| 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:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 print('path to source directory must be specified'); | 26 print('path to source directory must be specified'); |
| 27 exit(1); | 27 exit(1); |
| 28 } | 28 } |
| 29 source = args[SOURCE_OPTION]; | 29 source = args[SOURCE_OPTION]; |
| 30 priorityFile = args[PRIORITY_FILE_OPTION]; | 30 priorityFile = args[PRIORITY_FILE_OPTION]; |
| 31 offset = int.parse(args[COMPLETION_OFFSET]); | 31 offset = int.parse(args[COMPLETION_OFFSET]); |
| 32 | 32 |
| 33 Future.wait([new CompletionTimingTest().test_timing()]); | 33 Future.wait([new CompletionTimingTest().test_timing()]); |
| 34 } | 34 } |
| 35 | 35 |
| 36 const COMPLETION_OFFSET = 'offset'; |
| 36 const PRIORITY_FILE_OPTION = 'priority'; | 37 const PRIORITY_FILE_OPTION = 'priority'; |
| 37 const SOURCE_OPTION = 'source'; | 38 const SOURCE_OPTION = 'source'; |
| 38 const COMPLETION_OFFSET = 'offset'; | |
| 39 | 39 |
| 40 int offset; |
| 40 String priorityFile; | 41 String priorityFile; |
| 41 String source; | 42 String source; |
| 42 int offset; | |
| 43 | 43 |
| 44 ArgParser _createArgParser() => new ArgParser() | 44 ArgParser _createArgParser() => new ArgParser() |
| 45 ..addOption(SOURCE_OPTION, help: 'full path to source directory for analysis') | 45 ..addOption(SOURCE_OPTION, help: 'full path to source directory for analysis') |
| 46 ..addOption(PRIORITY_FILE_OPTION, help: 'full path to a priority file') | 46 ..addOption(PRIORITY_FILE_OPTION, help: 'full path to a priority file') |
| 47 ..addOption(COMPLETION_OFFSET, help: 'offset in file for code completions'); | 47 ..addOption(COMPLETION_OFFSET, help: 'offset in file for code completions'); |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * CompletionTimingTest measures the time taken for the analysis server to respo
nd with | 50 * CompletionTimingTest measures the time taken for the analysis server to respo
nd with |
| 51 * completion suggestions for a given file and offset. The time measured starts
when | 51 * completion suggestions for a given file and offset. The time measured starts
when |
| 52 * the analysis root is set and is done when the completion suggestions are rece
ived | 52 * the analysis root is set and is done when the completion suggestions are rece
ived |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 sendAnalysisSetPriorityFiles([priorityFile]); | 75 sendAnalysisSetPriorityFiles([priorityFile]); |
| 76 sendCompletionGetSuggestions(priorityFile, offset); | 76 sendCompletionGetSuggestions(priorityFile, offset); |
| 77 | 77 |
| 78 await analysisFinished; | 78 await analysisFinished; |
| 79 | 79 |
| 80 print('analysis completed in ${stopwatch.elapsed}'); | 80 print('analysis completed in ${stopwatch.elapsed}'); |
| 81 print('completion received at : $timings'); | 81 print('completion received at : $timings'); |
| 82 await shutdown(); | 82 await shutdown(); |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |