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

Side by Side Diff: pkg/analysis_server/lib/src/get_handler.dart

Issue 918383002: Rework analysis server performance measurement code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analysis_server.src.get_handler; 5 library analysis_server.src.get_handler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 AnalysisServer analysisServer = _server.analysisServer; 260 AnalysisServer analysisServer = _server.analysisServer;
261 if (analysisServer == null) { 261 if (analysisServer == null) {
262 return _returnFailure(request, 'Analysis server is not running'); 262 return _returnFailure(request, 'Analysis server is not running');
263 } 263 }
264 _writeResponse(request, (StringBuffer buffer) { 264 _writeResponse(request, (StringBuffer buffer) {
265 _writePage( 265 _writePage(
266 buffer, 266 buffer,
267 'Analysis Server - Analysis Performance', 267 'Analysis Server - Analysis Performance',
268 [], 268 [],
269 (StringBuffer buffer) { 269 (StringBuffer buffer) {
270 void writeRow(TimeCounter counter, String label) { 270 void writeRow(PerformanceTag tag) {
271 _writeRow(buffer, [counter.result, label], classes: ["right", null]); 271 _writeRow(buffer, [tag.elapsedMs, tag.label], classes: ["right", null] );
272 } 272 }
273 273
274 buffer.write('<h3>Analysis Performance</h3>'); 274 buffer.write('<h3>Analysis Performance</h3>');
275 buffer.write('<p><b>Time spent in each phase of analysis</b></p>'); 275 buffer.write('<p><b>Time spent in each phase of analysis</b></p>');
276 buffer.write( 276 buffer.write(
277 '<table style="border-collapse: separate; border-spacing: 10px 5px;" >'); 277 '<table style="border-collapse: separate; border-spacing: 10px 5px;" >');
278 _writeRow(buffer, ['Time (in ms)', 'Analysis Phase'], header: true); 278 _writeRow(buffer, ['Time (in ms)', 'Analysis Phase'], header: true);
279 writeRow(PerformanceStatistics.io, 'io'); 279 PerformanceTag.all.forEach(writeRow);
280 writeRow(PerformanceStatistics.scan, 'scan');
281 writeRow(PerformanceStatistics.parse, 'parse');
282 writeRow(PerformanceStatistics.resolve, 'resolve');
283 writeRow(PerformanceStatistics.errors, 'errors');
284 writeRow(PerformanceStatistics.hints, 'hints');
285 writeRow(PerformanceStatistics.lint, 'lint');
286 buffer.write('</table>'); 280 buffer.write('</table>');
287 281
288 Map<DataDescriptor, Map<CacheState, int>> transitionMap = SourceEntry.tr ansitionMap; 282 Map<DataDescriptor, Map<CacheState, int>> transitionMap = SourceEntry.tr ansitionMap;
289 buffer.write('<p><b>Number of times a state transitioned to VALID (group ed by descriptor)</b></p>'); 283 buffer.write('<p><b>Number of times a state transitioned to VALID (group ed by descriptor)</b></p>');
290 if (transitionMap.isEmpty) { 284 if (transitionMap.isEmpty) {
291 buffer.write('<p>none</p>'); 285 buffer.write('<p>none</p>');
292 } else { 286 } else {
293 List<DataDescriptor> descriptors = transitionMap.keys.toList(); 287 List<DataDescriptor> descriptors = transitionMap.keys.toList();
294 descriptors.sort( 288 descriptors.sort(
295 (DataDescriptor first, DataDescriptor second) => 289 (DataDescriptor first, DataDescriptor second) =>
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 * 'error'. 1624 * 'error'.
1631 */ 1625 */
1632 static String makeLink(String path, Map<String, String> params, 1626 static String makeLink(String path, Map<String, String> params,
1633 String innerHtml, [bool hasError = false]) { 1627 String innerHtml, [bool hasError = false]) {
1634 Uri uri = new Uri(path: path, queryParameters: params); 1628 Uri uri = new Uri(path: path, queryParameters: params);
1635 String href = HTML_ESCAPE.convert(uri.toString()); 1629 String href = HTML_ESCAPE.convert(uri.toString());
1636 String classAttribute = hasError ? ' class="error"' : ''; 1630 String classAttribute = hasError ? ' class="error"' : '';
1637 return '<a href="$href"$classAttribute>$innerHtml</a>'; 1631 return '<a href="$href"$classAttribute>$innerHtml</a>';
1638 } 1632 }
1639 } 1633 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698