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

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

Issue 2966383002: Tweaks to the profiling diagnostics page. (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 a5bccbe2e91aad1fbc41a83f076df1c28b8ed281..9efd1da24913ff31c9068348a030a9be23a26bac 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -988,14 +988,15 @@ class PluginsPage extends DiagnosticPageWithNav {
}
}
-// TODO(devoncarew): Show the last x requests and responses.
class ProfilePage extends DiagnosticPageWithNav {
ProfilePage(DiagnosticsSite site)
: super(site, 'profile', 'Profiling Info',
- description: 'Profiling performance tag data.');
+ description: 'Profiling performance tag data and lint timings.');
@override
void generateContent(Map<String, String> params) {
+ h3('Profiling performance tag data');
+
// prepare sorted tags
List<PerformanceTag> tags = PerformanceTag.all.toList();
tags.remove(ServerPerformanceStatistics.idle);
@@ -1003,6 +1004,11 @@ class ProfilePage extends DiagnosticPageWithNav {
tags.removeWhere((tag) => tag.elapsedMs == 0);
tags.sort((a, b) => b.elapsedMs - a.elapsedMs);
+ // print total time
+ int totalTime =
+ tags.fold<int>(0, (int a, PerformanceTag tag) => a + tag.elapsedMs);
+ p('Total measured time: ${printMilliseconds(totalTime)}');
+
// draw a pie chart
String rowData =
tags.map((tag) => "['${tag.label}', ${tag.elapsedMs}]").join(',');
@@ -1025,11 +1031,6 @@ class ProfilePage extends DiagnosticPageWithNav {
</script>
''');
- // print total time
- int totalTime =
- tags.fold<int>(0, (int a, PerformanceTag tag) => a + tag.elapsedMs);
- p('Total measured time: ${printMilliseconds(totalTime)}');
-
// write out a table
void _writeRow(List<String> data, {bool header: false}) {
buf.write('<tr>');
@@ -1061,7 +1062,12 @@ class ProfilePage extends DiagnosticPageWithNav {
tags.forEach(writeRow);
buf.write('</table>');
+ h3('Lint rule timings');
List<LintRule> rules = Registry.ruleRegistry.rules.toList();
+ int totalLintTime = rules.fold(0,
+ (sum, rule) => sum + lintRegistry.getTimer(rule).elapsedMilliseconds);
+ p('Total time spent in lints: ${printMilliseconds(totalLintTime)}');
+
rules.sort((first, second) {
int firstTime = lintRegistry.getTimer(first).elapsedMilliseconds;
int secondTime = lintRegistry.getTimer(second).elapsedMilliseconds;
@@ -1070,17 +1076,13 @@ class ProfilePage extends DiagnosticPageWithNav {
}
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()]);
+ _writeRow([rule.lintCode.name, printMilliseconds(time)]);
}
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