@@ -199,17 +199,16 @@ _CollectedOptionsData _collectOptionsData(AnalysisDriver driver) {
199199 return (totalProducerTime, details.toString ());
200200}
201201
202- class AnalysisDriverTimingsPage extends DiagnosticPageWithNav
203- implements PostablePage {
202+ class AnalysisDriverPage extends DiagnosticPageWithNav implements PostablePage {
204203 static const _resetFormId = 'reset-driver-timers' ;
205204
206- AnalysisDriverTimingsPage (DiagnosticsSite site)
205+ AnalysisDriverPage (DiagnosticsSite site)
207206 : super (
208207 site,
209- 'driver-timings ' ,
210- 'Analysis Driver ' ,
208+ 'analysis-driver ' ,
209+ 'Analysis driver ' ,
211210 description:
212- 'Timing statistics collected by the analysis driver scheduler since last reset.' ,
211+ 'Timing statistics collected by the analysis driver scheduler since the last reset.' ,
213212 indentInNav: true ,
214213 );
215214
@@ -249,8 +248,8 @@ class AnalysisPerformanceLogPage extends WebSocketLoggingPage {
249248 : super (
250249 site,
251250 'analysis-performance-log' ,
252- 'Analysis Performance Log ' ,
253- description: 'Realtime logging from the Analysis Performance Log ' ,
251+ 'Analysis performance log ' ,
252+ description: 'Real-time logging from the analysis performance log ' ,
254253 );
255254
256255 @override
@@ -334,7 +333,7 @@ class AssistsPage extends DiagnosticPageWithNav with PerformanceChartMixin {
334333 AssistsPage (DiagnosticsSite site)
335334 : super (
336335 site,
337- 'getAssists ' ,
336+ 'assists ' ,
338337 'Assists' ,
339338 description: 'Latency and timing statistics for getting assists.' ,
340339 indentInNav: true ,
@@ -437,82 +436,79 @@ class AstPage extends DiagnosticPageWithNav {
437436 }
438437}
439438
440- class ByteStoreTimingPage extends DiagnosticPageWithNav
439+ class ClientPage extends DiagnosticPageWithNav {
440+ ClientPage (super .site, [super .id = 'client' , super .title = 'Client' ])
441+ : super (description: 'Information about the client.' );
442+
443+ @override
444+ Future <void > generateContent (Map <String , String > params) async {
445+ h3 ('Client Diagnostic Information' );
446+ prettyJson (server.clientDiagnosticInformation);
447+ }
448+ }
449+
450+ class CodeCompletionPage extends DiagnosticPageWithNav
441451 with PerformanceChartMixin {
442- ByteStoreTimingPage (DiagnosticsSite site)
452+ CodeCompletionPage (DiagnosticsSite site)
443453 : super (
444454 site,
445- 'byte-store-timing ' ,
446- 'FileByteStore ' ,
447- description: 'FileByteStore Timing statistics.' ,
455+ 'code-completion ' ,
456+ 'Code Completion ' ,
457+ description: 'Latency statistics for code completion .' ,
448458 indentInNav: true ,
449459 );
450460
461+ path.Context get pathContext => server.resourceProvider.pathContext;
462+
463+ List <CompletionPerformance > get performanceItems =>
464+ server.recentPerformance.completion.items.toList ();
465+
451466 @override
452467 Future <void > generateContent (Map <String , String > params) async {
453- h3 ( 'FileByteStore Timings' ) ;
468+ var completions = performanceItems ;
454469
455- var byteStoreTimings =
456- server.byteStoreTimings
457- ? .where (
458- (timing) =>
459- timing.readCount != 0 || timing.readTime != Duration .zero,
460- )
461- .toList ();
462- if (byteStoreTimings == null || byteStoreTimings.isEmpty) {
463- p (
464- 'There are currently no timings. '
465- 'Try refreshing after the server has performed initial analysis.' ,
466- );
470+ if (completions.isEmpty) {
471+ blankslate ('No completions recorded.' );
467472 return ;
468473 }
469474
475+ var fastCount =
476+ completions.where ((c) => c.elapsedInMilliseconds <= 100 ).length;
477+ p (
478+ '${completions .length } results; ${printPercentage (fastCount / completions .length )} within 100ms.' ,
479+ );
480+
481+ drawChart (completions);
482+
483+ // emit the data as a table
470484 buf.writeln ('<table>' );
471485 buf.writeln (
472- '<tr><th>Files Read </th><th>Time Taken </th><th> </th></tr>' ,
486+ '<tr><th>Time</th><th>Computed Results </th><th>Transmitted Results </th><th>Source</th><th>Snippet </th></tr>' ,
473487 );
474- for (var i = 0 ; i < byteStoreTimings.length; i++ ) {
475- var timing = byteStoreTimings[i];
476- if (timing.readCount == 0 ) {
477- continue ;
478- }
479-
480- var nextTiming =
481- i + 1 < byteStoreTimings.length ? byteStoreTimings[i + 1 ] : null ;
482- var duration = (nextTiming? .time ?? DateTime .now ()).difference (
483- timing.time,
484- );
485- var description =
486- 'Between <em>${timing .reason }</em> and <em>${nextTiming ?.reason ?? 'now' } (${printMilliseconds (duration .inMilliseconds )})</em>.' ;
488+ for (var completion in completions) {
489+ var shortName = pathContext.basename (completion.path);
487490 buf.writeln (
488491 '<tr>'
489- '<td class="right">${timing .readCount } files</td>'
490- '<td class="right">${printMilliseconds (timing .readTime .inMilliseconds )}</td>'
491- '<td>$description </td>'
492+ '<td class="pre right"><a href="/timing?id=${completion .id }&kind=completion">'
493+ '${_formatLatencyTiming (completion .elapsedInMilliseconds , completion .requestLatency )}'
494+ '</a></td>'
495+ '<td class="right">${completion .computedSuggestionCountStr }</td>'
496+ '<td class="right">${completion .transmittedSuggestionCountStr }</td>'
497+ '<td>${escape (shortName )}</td>'
498+ '<td><code>${escape (completion .snippet )}</code></td>'
492499 '</tr>' ,
493500 );
494501 }
495502 buf.writeln ('</table>' );
496503 }
497504}
498505
499- class ClientPage extends DiagnosticPageWithNav {
500- ClientPage (super .site, [super .id = 'client' , super .title = 'Client' ])
501- : super (description: 'Information about the client.' );
502-
503- @override
504- Future <void > generateContent (Map <String , String > params) async {
505- h3 ('Client Diagnostic Information' );
506- prettyJson (server.clientDiagnosticInformation);
507- }
508- }
509-
510506class CollectReportPage extends DiagnosticPage {
511507 CollectReportPage (DiagnosticsSite site)
512508 : super (
513509 site,
514- 'collectreport ' ,
515- 'Collect Report ' ,
510+ 'collect-report ' ,
511+ 'Collect report ' ,
516512 description: 'Collect a shareable report for filing issues.' ,
517513 );
518514
@@ -959,61 +955,6 @@ class CommunicationsPage extends DiagnosticPageWithNav {
959955 }
960956}
961957
962- class CompletionPage extends DiagnosticPageWithNav with PerformanceChartMixin {
963- CompletionPage (DiagnosticsSite site)
964- : super (
965- site,
966- 'completion' ,
967- 'Code Completion' ,
968- description: 'Latency statistics for code completion.' ,
969- indentInNav: true ,
970- );
971-
972- path.Context get pathContext => server.resourceProvider.pathContext;
973-
974- List <CompletionPerformance > get performanceItems =>
975- server.recentPerformance.completion.items.toList ();
976-
977- @override
978- Future <void > generateContent (Map <String , String > params) async {
979- var completions = performanceItems;
980-
981- if (completions.isEmpty) {
982- blankslate ('No completions recorded.' );
983- return ;
984- }
985-
986- var fastCount =
987- completions.where ((c) => c.elapsedInMilliseconds <= 100 ).length;
988- p (
989- '${completions .length } results; ${printPercentage (fastCount / completions .length )} within 100ms.' ,
990- );
991-
992- drawChart (completions);
993-
994- // emit the data as a table
995- buf.writeln ('<table>' );
996- buf.writeln (
997- '<tr><th>Time</th><th>Computed Results</th><th>Transmitted Results</th><th>Source</th><th>Snippet</th></tr>' ,
998- );
999- for (var completion in completions) {
1000- var shortName = pathContext.basename (completion.path);
1001- buf.writeln (
1002- '<tr>'
1003- '<td class="pre right"><a href="/timing?id=${completion .id }&kind=completion">'
1004- '${_formatLatencyTiming (completion .elapsedInMilliseconds , completion .requestLatency )}'
1005- '</a></td>'
1006- '<td class="right">${completion .computedSuggestionCountStr }</td>'
1007- '<td class="right">${completion .transmittedSuggestionCountStr }</td>'
1008- '<td>${escape (shortName )}</td>'
1009- '<td><code>${escape (completion .snippet )}</code></td>'
1010- '</tr>' ,
1011- );
1012- }
1013- buf.writeln ('</table>' );
1014- }
1015- }
1016-
1017958class ContentsPage extends DiagnosticPageWithNav {
1018959 String ? _description;
1019960
@@ -1550,10 +1491,10 @@ class DiagnosticsSite extends Site implements AbstractHttpHandler {
15501491 // Add timing pages
15511492 pages.add (TimingPage (this ));
15521493 // (Nested)
1553- pages.add (AnalysisDriverTimingsPage (this ));
1494+ pages.add (AnalysisDriverPage (this ));
15541495 pages.add (AssistsPage (this ));
1555- pages.add (ByteStoreTimingPage (this ));
1556- pages.add (CompletionPage (this ));
1496+ pages.add (FileByteStoreTimingPage (this ));
1497+ pages.add (CodeCompletionPage (this ));
15571498 pages.add (FixesPage (this ));
15581499 pages.add (MessageSchedulerPage (this ));
15591500 pages.add (RefactoringsPage (this ));
@@ -1576,7 +1517,7 @@ class ElementModelPage extends DiagnosticPageWithNav {
15761517 ElementModelPage (DiagnosticsSite site)
15771518 : super (
15781519 site,
1579- 'element' ,
1520+ 'element-model ' ,
15801521 'Element model' ,
15811522 description: 'The element model for a file.' ,
15821523 );
@@ -1639,7 +1580,7 @@ class EnvironmentVariablesPage extends DiagnosticPageWithNav {
16391580 : super (
16401581 site,
16411582 'environment' ,
1642- 'Environment Variables ' ,
1583+ 'Environment variables ' ,
16431584 description:
16441585 'System environment variables as seen from the analysis server.' ,
16451586 );
@@ -1707,7 +1648,7 @@ class FeedbackPage extends DiagnosticPage {
17071648 site,
17081649 'feedback' ,
17091650 'Feedback' ,
1710- description: 'Providing feedback and filing issues.' ,
1651+ description: 'How to provide feedback and file issues.' ,
17111652 );
17121653
17131654 @override
@@ -1746,11 +1687,70 @@ class FeedbackPage extends DiagnosticPage {
17461687 }
17471688}
17481689
1690+ class FileByteStoreTimingPage extends DiagnosticPageWithNav
1691+ with PerformanceChartMixin {
1692+ FileByteStoreTimingPage (DiagnosticsSite site)
1693+ : super (
1694+ site,
1695+ 'file-byte-store-timing' ,
1696+ 'FileByteStore timing' ,
1697+ description: 'FileByteStore timing statistics.' ,
1698+ indentInNav: true ,
1699+ );
1700+
1701+ @override
1702+ Future <void > generateContent (Map <String , String > params) async {
1703+ h3 ('FileByteStore Timings' );
1704+
1705+ var byteStoreTimings =
1706+ server.byteStoreTimings
1707+ ? .where (
1708+ (timing) =>
1709+ timing.readCount != 0 || timing.readTime != Duration .zero,
1710+ )
1711+ .toList ();
1712+ if (byteStoreTimings == null || byteStoreTimings.isEmpty) {
1713+ p (
1714+ 'There are currently no timings. '
1715+ 'Try refreshing after the server has performed initial analysis.' ,
1716+ );
1717+ return ;
1718+ }
1719+
1720+ buf.writeln ('<table>' );
1721+ buf.writeln (
1722+ '<tr><th>Files Read</th><th>Time Taken</th><th> </th></tr>' ,
1723+ );
1724+ for (var i = 0 ; i < byteStoreTimings.length; i++ ) {
1725+ var timing = byteStoreTimings[i];
1726+ if (timing.readCount == 0 ) {
1727+ continue ;
1728+ }
1729+
1730+ var nextTiming =
1731+ i + 1 < byteStoreTimings.length ? byteStoreTimings[i + 1 ] : null ;
1732+ var duration = (nextTiming? .time ?? DateTime .now ()).difference (
1733+ timing.time,
1734+ );
1735+ var description =
1736+ 'Between <em>${timing .reason }</em> and <em>${nextTiming ?.reason ?? 'now' } (${printMilliseconds (duration .inMilliseconds )})</em>.' ;
1737+ buf.writeln (
1738+ '<tr>'
1739+ '<td class="right">${timing .readCount } files</td>'
1740+ '<td class="right">${printMilliseconds (timing .readTime .inMilliseconds )}</td>'
1741+ '<td>$description </td>'
1742+ '</tr>' ,
1743+ );
1744+ }
1745+ buf.writeln ('</table>' );
1746+ }
1747+ }
1748+
17491749class FixesPage extends DiagnosticPageWithNav with PerformanceChartMixin {
17501750 FixesPage (DiagnosticsSite site)
17511751 : super (
17521752 site,
1753- 'getFixes ' ,
1753+ 'fixes ' ,
17541754 'Fixes' ,
17551755 description: 'Latency and timing statistics for getting fixes.' ,
17561756 indentInNav: true ,
@@ -1809,8 +1809,8 @@ class LspCapabilitiesPage extends DiagnosticPageWithNav {
18091809 LspCapabilitiesPage (DiagnosticsSite site, this .server)
18101810 : super (
18111811 site,
1812- 'lsp_capabilities ' ,
1813- 'LSP Capabilities ' ,
1812+ 'lsp-capabilities ' ,
1813+ 'LSP capabilities ' ,
18141814 description: 'Client and Server LSP Capabilities.' ,
18151815 indentInNav: true ,
18161816 );
@@ -1872,8 +1872,8 @@ class LspRegistrationsPage extends DiagnosticPageWithNav {
18721872 LspRegistrationsPage (DiagnosticsSite site, this .server)
18731873 : super (
18741874 site,
1875- 'lsp_registrations ' ,
1876- 'LSP Registrations ' ,
1875+ 'lsp-registrations ' ,
1876+ 'LSP registrations ' ,
18771877 description: 'Current LSP feature registrations.' ,
18781878 indentInNav: true ,
18791879 );
@@ -1931,8 +1931,8 @@ class MemoryAndCpuPage extends DiagnosticPageWithNav {
19311931 MemoryAndCpuPage (DiagnosticsSite site, this .profiler)
19321932 : super (
19331933 site,
1934- 'memory' ,
1935- 'Memory and CPU Usage ' ,
1934+ 'memory-and-cpu-usage ' ,
1935+ 'Memory and CPU usage ' ,
19361936 description: 'Memory and CPU usage for the analysis server.' ,
19371937 );
19381938
0 commit comments