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:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analysis_server/protocol/protocol_generated.dart'; | 9 import 'package:analysis_server/protocol/protocol_generated.dart'; |
10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 import 'package:analyzer/source/package_map_resolver.dart'; | 24 import 'package:analyzer/source/package_map_resolver.dart'; |
25 import 'package:analyzer/source/sdk_ext.dart'; | 25 import 'package:analyzer/source/sdk_ext.dart'; |
26 import 'package:analyzer/src/context/source.dart'; | 26 import 'package:analyzer/src/context/source.dart'; |
27 import 'package:analyzer/src/dart/analysis/driver.dart'; | 27 import 'package:analyzer/src/dart/analysis/driver.dart'; |
28 import 'package:analyzer/src/dart/analysis/file_state.dart'; | 28 import 'package:analyzer/src/dart/analysis/file_state.dart'; |
29 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 29 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
30 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; | 30 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; |
31 import 'package:analyzer/src/generated/sdk.dart'; | 31 import 'package:analyzer/src/generated/sdk.dart'; |
32 import 'package:analyzer/src/generated/source.dart'; | 32 import 'package:analyzer/src/generated/source.dart'; |
33 import 'package:analyzer/src/generated/utilities_general.dart'; | 33 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 34 import 'package:analyzer/src/lint/linter.dart'; |
| 35 import 'package:analyzer/src/lint/registry.dart'; |
| 36 import 'package:analyzer/src/services/lint.dart'; |
34 import 'package:plugin/plugin.dart'; | 37 import 'package:plugin/plugin.dart'; |
35 | 38 |
36 final String kCustomCss = ''' | 39 final String kCustomCss = ''' |
37 .lead, .page-title+.markdown-body>p:first-child { | 40 .lead, .page-title+.markdown-body>p:first-child { |
38 margin-bottom: 30px; | 41 margin-bottom: 30px; |
39 font-size: 20px; | 42 font-size: 20px; |
40 font-weight: 300; | 43 font-weight: 300; |
41 color: #555; | 44 color: #555; |
42 } | 45 } |
43 | 46 |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 double percent = tag.elapsedMs / totalTime; | 1053 double percent = tag.elapsedMs / totalTime; |
1051 _writeRow([ | 1054 _writeRow([ |
1052 tag.label, | 1055 tag.label, |
1053 printMilliseconds(tag.elapsedMs), | 1056 printMilliseconds(tag.elapsedMs), |
1054 printPercentage(percent) | 1057 printPercentage(percent) |
1055 ]); | 1058 ]); |
1056 } | 1059 } |
1057 | 1060 |
1058 tags.forEach(writeRow); | 1061 tags.forEach(writeRow); |
1059 buf.write('</table>'); | 1062 buf.write('</table>'); |
| 1063 |
| 1064 List<LintRule> rules = Registry.ruleRegistry.rules.toList(); |
| 1065 rules.sort((first, second) { |
| 1066 int firstTime = lintRegistry.getTimer(first).elapsedMilliseconds; |
| 1067 int secondTime = lintRegistry.getTimer(second).elapsedMilliseconds; |
| 1068 if (firstTime == secondTime) { |
| 1069 return first.lintCode.name.compareTo(second.lintCode.name); |
| 1070 } |
| 1071 return secondTime - firstTime; |
| 1072 }); |
| 1073 p('Lint rule timings'); |
| 1074 buf.write('<table>'); |
| 1075 _writeRow(['Lint code', 'Time (in ms)'], header: true); |
| 1076 int totalLintTime = 0; |
| 1077 for (var rule in rules) { |
| 1078 int time = lintRegistry.getTimer(rule).elapsedMilliseconds; |
| 1079 totalLintTime += time; |
| 1080 _writeRow([rule.lintCode.name, time.toString()]); |
| 1081 } |
| 1082 buf.write('</table>'); |
| 1083 p('Total time spent in lints: $totalLintTime ms'); |
1060 } | 1084 } |
1061 } | 1085 } |
1062 | 1086 |
1063 class StatusPage extends DiagnosticPageWithNav { | 1087 class StatusPage extends DiagnosticPageWithNav { |
1064 StatusPage(DiagnosticsSite site) | 1088 StatusPage(DiagnosticsSite site) |
1065 : super(site, 'status', 'Status', | 1089 : super(site, 'status', 'Status', |
1066 description: | 1090 description: |
1067 'General status and diagnostics for the analysis server.'); | 1091 'General status and diagnostics for the analysis server.'); |
1068 | 1092 |
1069 @override | 1093 @override |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 h3('Execution domain'); | 1151 h3('Execution domain'); |
1128 ul(ExecutionService.VALUES, (item) { | 1152 ul(ExecutionService.VALUES, (item) { |
1129 if (domain.onFileAnalyzed != null) { | 1153 if (domain.onFileAnalyzed != null) { |
1130 buf.write('$item (has subscriptions)'); | 1154 buf.write('$item (has subscriptions)'); |
1131 } else { | 1155 } else { |
1132 buf.write('$item (no subscriptions)'); | 1156 buf.write('$item (no subscriptions)'); |
1133 } | 1157 } |
1134 }); | 1158 }); |
1135 } | 1159 } |
1136 } | 1160 } |
OLD | NEW |