| 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');
|
| }
|
| }
|
|
|
|
|