Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: pkg/analysis_server/lib/src/status/diagnostics.dart

Issue 2970153002: Add lint timing information to the status pages (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/status/diagnostics.dart
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index ea28c30f1a8cbe32adaa3122883189c587687ca8..a5bccbe2e91aad1fbc41a83f076df1c28b8ed281 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -31,6 +31,9 @@ import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
+import 'package:analyzer/src/lint/linter.dart';
+import 'package:analyzer/src/lint/registry.dart';
+import 'package:analyzer/src/services/lint.dart';
import 'package:plugin/plugin.dart';
final String kCustomCss = '''
@@ -1057,6 +1060,27 @@ class ProfilePage extends DiagnosticPageWithNav {
tags.forEach(writeRow);
buf.write('</table>');
+
+ List<LintRule> rules = Registry.ruleRegistry.rules.toList();
+ rules.sort((first, second) {
+ int firstTime = lintRegistry.getTimer(first).elapsedMilliseconds;
+ int secondTime = lintRegistry.getTimer(second).elapsedMilliseconds;
+ if (firstTime == secondTime) {
+ return first.lintCode.name.compareTo(second.lintCode.name);
+ }
+ return secondTime - firstTime;
+ });
+ p('Lint rule timings');
+ buf.write('<table>');
+ _writeRow(['Lint code', 'Time (in ms)'], header: true);
+ int totalLintTime = 0;
+ for (var rule in rules) {
+ int time = lintRegistry.getTimer(rule).elapsedMilliseconds;
+ totalLintTime += time;
+ _writeRow([rule.lintCode.name, time.toString()]);
+ }
+ buf.write('</table>');
+ p('Total time spent in lints: $totalLintTime ms');
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698