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

Side by Side Diff: pkg/analysis_server/lib/src/status/diagnostics.dart

Issue 2917183003: update the analyzer and analysis server perf tags (Closed)
Patch Set: updates for review comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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:convert'; 5 import 'dart:convert';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:analysis_server/protocol/protocol_generated.dart'; 8 import 'package:analysis_server/protocol/protocol_generated.dart';
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 21 matching lines...) Expand all
32 .lead, .page-title+.markdown-body>p:first-child { 32 .lead, .page-title+.markdown-body>p:first-child {
33 margin-bottom: 30px; 33 margin-bottom: 30px;
34 font-size: 20px; 34 font-size: 20px;
35 font-weight: 300; 35 font-weight: 300;
36 color: #555; 36 color: #555;
37 } 37 }
38 38
39 .container { 39 .container {
40 width: 1160px; 40 width: 1160px;
41 } 41 }
42 42
43 .masthead { 43 .masthead {
44 padding-top: 1rem; 44 padding-top: 1rem;
45 padding-bottom: 1rem; 45 padding-bottom: 1rem;
46 margin-bottom: 1.5rem; 46 margin-bottom: 1.5rem;
47 text-align: center; 47 text-align: center;
48 background-color: #4078c0; 48 background-color: #4078c0;
49 } 49 }
50 50
51 .masthead .masthead-logo { 51 .masthead .masthead-logo {
52 display: inline-block; 52 display: inline-block;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 font-weight: bold; 86 font-weight: bold;
87 line-height: 1; 87 line-height: 1;
88 color: #666; 88 color: #666;
89 background-color: #eee; 89 background-color: #eee;
90 border-radius: 20px; 90 border-radius: 20px;
91 } 91 }
92 92
93 .menu-item .counter { 93 .menu-item .counter {
94 float: right; 94 float: right;
95 margin-left: 5px; 95 margin-left: 5px;
96 } 96 }
97 97
98 td.right { 98 td.right {
99 text-align: right; 99 text-align: right;
100 } 100 }
101 101
102 td.pre { 102 td.pre {
103 white-space: pre; 103 white-space: pre;
104 } 104 }
105 105
106 .nowrap { 106 .nowrap {
107 white-space: nowrap; 107 white-space: nowrap;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 buf.writeln('</div>'); 232 buf.writeln('</div>');
233 buf.writeln('</div>'); 233 buf.writeln('</div>');
234 } 234 }
235 235
236 void generateContent(Map<String, String> params); 236 void generateContent(Map<String, String> params);
237 237
238 void generateFooter() { 238 void generateFooter() {
239 buf.writeln(''' 239 buf.writeln('''
240 <footer class="footer"> 240 <footer class="footer">
241 Dart ${site.title} <span style="float:right">SDK ${_sdkVersion}</span> 241 Dart ${site.title} <span style="float:right">SDK ${_sdkVersion}</span>
242 </footer> 242 </footer>
243 '''); 243 ''');
244 } 244 }
245 245
246 bool get isNavPage => false; 246 bool get isNavPage => false;
247 } 247 }
248 248
249 abstract class DiagnosticPageWithNav extends DiagnosticPage { 249 abstract class DiagnosticPageWithNav extends DiagnosticPage {
250 DiagnosticPageWithNav(Site site, String id, String title, 250 DiagnosticPageWithNav(Site site, String id, String title,
251 {String description}) 251 {String description})
252 : super(site, id, title, description: description); 252 : super(site, id, title, description: description);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 class ProfilePage extends DiagnosticPageWithNav { 425 class ProfilePage extends DiagnosticPageWithNav {
426 ProfilePage(DiagnosticsSite site) 426 ProfilePage(DiagnosticsSite site)
427 : super(site, 'profile', 'Profiling Info', 427 : super(site, 'profile', 'Profiling Info',
428 description: 'Profiling performance tag data.'); 428 description: 'Profiling performance tag data.');
429 429
430 @override 430 @override
431 void generateContent(Map<String, String> params) { 431 void generateContent(Map<String, String> params) {
432 // prepare sorted tags 432 // prepare sorted tags
433 List<PerformanceTag> tags = PerformanceTag.all.toList(); 433 List<PerformanceTag> tags = PerformanceTag.all.toList();
434 tags.remove(ServerPerformanceStatistics.idle); 434 tags.remove(ServerPerformanceStatistics.idle);
435 tags.remove(PerformanceTag.UNKNOWN); 435 tags.remove(PerformanceTag.unknown);
436 tags.removeWhere((tag) => tag.elapsedMs == 0);
436 tags.sort((a, b) => b.elapsedMs - a.elapsedMs); 437 tags.sort((a, b) => b.elapsedMs - a.elapsedMs);
437 438
438 // draw a pie chart 439 // draw a pie chart
439 String rowData = 440 String rowData =
440 tags.map((tag) => "['${tag.label}', ${tag.elapsedMs}]").join(','); 441 tags.map((tag) => "['${tag.label}', ${tag.elapsedMs}]").join(',');
441 buf.writeln( 442 buf.writeln(
442 '<div id="chart-div" style="width: 700px; height: 300px;"></div>'); 443 '<div id="chart-div" style="width: 700px; height: 300px;"></div>');
443 buf.writeln(''' 444 buf.writeln('''
444 <script type="text/javascript"> 445 <script type="text/javascript">
445 google.charts.load('current', {'packages':['corechart']}); 446 google.charts.load('current', {'packages':['corechart']});
446 google.charts.setOnLoadCallback(drawChart); 447 google.charts.setOnLoadCallback(drawChart);
447 448
448 function drawChart() { 449 function drawChart() {
449 var data = new google.visualization.DataTable(); 450 var data = new google.visualization.DataTable();
450 data.addColumn('string', 'Tag'); 451 data.addColumn('string', 'Tag');
451 data.addColumn('number', 'Time (ms)'); 452 data.addColumn('number', 'Time (ms)');
452 data.addRows([$rowData]); 453 data.addRows([$rowData]);
453 var options = {'title': 'Performance Tag Data', 'width': 700, 'height' : 300}; 454 var options = {'title': 'Performance Tag Data', 'width': 700, 'height' : 300};
454 var chart = new google.visualization.PieChart(document.getElementById( 'chart-div')); 455 var chart = new google.visualization.PieChart(document.getElementById( 'chart-div'));
455 chart.draw(data, options); 456 chart.draw(data, options);
456 } 457 }
457 </script> 458 </script>
458 '''); 459 ''');
459 460
460 // print total time 461 // print total time
461 int totalTime = 462 int totalTime =
462 tags.fold<int>(0, (int a, PerformanceTag tag) => a + tag.elapsedMs); 463 tags.fold<int>(0, (int a, PerformanceTag tag) => a + tag.elapsedMs);
463 p('Total measured time: ${printMilliseconds(totalTime)}'); 464 p('Total measured time: ${printMilliseconds(totalTime)}');
464 465
465 // write out a table 466 // write out a table
466 void _writeRow(List<String> data, {bool header: false}) { 467 void _writeRow(List<String> data, {bool header: false}) {
467 buf.write('<tr>'); 468 buf.write('<tr>');
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 google.charts.setOnLoadCallback(drawChart); 843 google.charts.setOnLoadCallback(drawChart);
843 function drawChart() { 844 function drawChart() {
844 var data = google.visualization.arrayToDataTable([ 845 var data = google.visualization.arrayToDataTable([
845 ['Completions', 'Time'], 846 ['Completions', 'Time'],
846 $rowData 847 $rowData
847 ]); 848 ]);
848 var options = { bars: 'vertical', vAxis: {format: 'decimal'}, height: 30 0 }; 849 var options = { bars: 'vertical', vAxis: {format: 'decimal'}, height: 30 0 };
849 var chart = new google.charts.Bar(document.getElementById('chart-div')); 850 var chart = new google.charts.Bar(document.getElementById('chart-div'));
850 chart.draw(data, google.charts.Bar.convertOptions(options)); 851 chart.draw(data, google.charts.Bar.convertOptions(options));
851 } 852 }
852 </script> 853 </script>
853 '''); 854 ''');
854 855
855 // emit the data as a table 856 // emit the data as a table
856 buf.writeln('<table>'); 857 buf.writeln('<table>');
857 buf.writeln( 858 buf.writeln(
858 '<tr><th>Time</th><th>Results</th><th>Source</th><th>Snippet</th></tr>') ; 859 '<tr><th>Time</th><th>Results</th><th>Source</th><th>Snippet</th></tr>') ;
859 for (CompletionPerformance completion in completions) { 860 for (CompletionPerformance completion in completions) {
860 buf.writeln('<tr>' 861 buf.writeln('<tr>'
861 '<td class="pre right">${printMilliseconds(completion.elapsedInMillise conds)}</td>' 862 '<td class="pre right">${printMilliseconds(completion.elapsedInMillise conds)}</td>'
862 '<td class="right">${completion.suggestionCount}</td>' 863 '<td class="right">${completion.suggestionCount}</td>'
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 return '$name: <code>$value</code><br> '; 963 return '$name: <code>$value</code><br> ';
963 } 964 }
964 965
965 String get _sdkVersion { 966 String get _sdkVersion {
966 String version = Platform.version; 967 String version = Platform.version;
967 if (version.contains(' ')) { 968 if (version.contains(' ')) {
968 version = version.substring(0, version.indexOf(' ')); 969 version = version.substring(0, version.indexOf(' '));
969 } 970 }
970 return version; 971 return version;
971 } 972 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698