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

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

Issue 1406983007: Compute and display tasks input timings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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) 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.status.get_handler; 5 library analysis_server.src.status.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 17 matching lines...) Expand all
28 import 'package:analyzer/src/generated/ast.dart'; 28 import 'package:analyzer/src/generated/ast.dart';
29 import 'package:analyzer/src/generated/element.dart'; 29 import 'package:analyzer/src/generated/element.dart';
30 import 'package:analyzer/src/generated/engine.dart' 30 import 'package:analyzer/src/generated/engine.dart'
31 hide AnalysisCache, AnalysisContextImpl, AnalysisTask; 31 hide AnalysisCache, AnalysisContextImpl, AnalysisTask;
32 import 'package:analyzer/src/generated/java_engine.dart'; 32 import 'package:analyzer/src/generated/java_engine.dart';
33 import 'package:analyzer/src/generated/resolver.dart'; 33 import 'package:analyzer/src/generated/resolver.dart';
34 import 'package:analyzer/src/generated/source.dart'; 34 import 'package:analyzer/src/generated/source.dart';
35 import 'package:analyzer/src/generated/utilities_collection.dart'; 35 import 'package:analyzer/src/generated/utilities_collection.dart';
36 import 'package:analyzer/src/generated/utilities_general.dart'; 36 import 'package:analyzer/src/generated/utilities_general.dart';
37 import 'package:analyzer/src/task/dart.dart'; 37 import 'package:analyzer/src/task/dart.dart';
38 import 'package:analyzer/src/task/driver.dart';
38 import 'package:analyzer/src/task/html.dart'; 39 import 'package:analyzer/src/task/html.dart';
39 import 'package:analyzer/src/task/options.dart'; 40 import 'package:analyzer/src/task/options.dart';
40 import 'package:analyzer/task/dart.dart'; 41 import 'package:analyzer/task/dart.dart';
41 import 'package:analyzer/task/general.dart'; 42 import 'package:analyzer/task/general.dart';
42 import 'package:analyzer/task/html.dart'; 43 import 'package:analyzer/task/html.dart';
43 import 'package:analyzer/task/model.dart'; 44 import 'package:analyzer/task/model.dart';
44 import 'package:plugin/plugin.dart'; 45 import 'package:plugin/plugin.dart';
45 46
46 /** 47 /**
47 * A function that can be used to generate HTML output into the given [buffer]. 48 * A function that can be used to generate HTML output into the given [buffer].
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 null, 550 null,
550 "right", 551 "right",
551 "right", 552 "right",
552 "right" 553 "right"
553 ]); 554 ]);
554 }); 555 });
555 _writeRow(buffer, ['Total', '-', totalTaskTime, '-'], 556 _writeRow(buffer, ['Total', '-', totalTaskTime, '-'],
556 classes: [null, "right", "right", "right"]); 557 classes: [null, "right", "right", "right"]);
557 buffer.write('</table>'); 558 buffer.write('</table>');
558 }); 559 });
560 //
561 // Write task model inputs timing information.
562 //
563 {
564 buffer.write('<p><b>Task inputs performace data</b></p>');
565 buffer.write(
566 '<table style="border-collapse: separate; border-spacing: 10px 5px ;">');
567 _writeRow(
568 buffer,
569 [
570 'Task Name',
571 'Count',
572 'Total Time (in ms)',
573 'Average Time (in ms)'
574 ],
575 header: true);
576
577 Map<String, int> countMap = WorkItem.countMap;
578 Map<String, Stopwatch> stopwatchMap = WorkItem.stopwatchMap;
579 List<String> taskClasses = stopwatchMap.keys.toList();
580 taskClasses.sort((String first, String second) =>
581 first.toString().compareTo(second.toString()));
582 taskClasses.forEach((String taskClass) {
583 int count = countMap[taskClass];
584 if (count == null) {
585 count = 0;
586 }
587 int taskTime = stopwatchMap[taskClass].elapsedMilliseconds;
588 _writeRow(buffer, [
589 taskClass.toString(),
590 count,
591 taskTime,
592 count <= 0 ? '-' : (taskTime / count).toStringAsFixed(3)
593 ], classes: [
594 null,
595 "right",
596 "right",
597 "right"
598 ]);
599 });
600 buffer.write('</table>');
601 }
559 }); 602 });
560 }); 603 });
561 } 604 }
562 605
563 /** 606 /**
564 * Return a response containing information about an AST structure. 607 * Return a response containing information about an AST structure.
565 */ 608 */
566 void _returnAst(HttpRequest request) { 609 void _returnAst(HttpRequest request) {
567 AnalysisServer analysisServer = _server.analysisServer; 610 AnalysisServer analysisServer = _server.analysisServer;
568 if (analysisServer == null) { 611 if (analysisServer == null) {
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 */ 1941 */
1899 static String makeLink( 1942 static String makeLink(
1900 String path, Map<String, String> params, String innerHtml, 1943 String path, Map<String, String> params, String innerHtml,
1901 [bool hasError = false]) { 1944 [bool hasError = false]) {
1902 Uri uri = new Uri(path: path, queryParameters: params); 1945 Uri uri = new Uri(path: path, queryParameters: params);
1903 String href = HTML_ESCAPE.convert(uri.toString()); 1946 String href = HTML_ESCAPE.convert(uri.toString());
1904 String classAttribute = hasError ? ' class="error"' : ''; 1947 String classAttribute = hasError ? ' class="error"' : '';
1905 return '<a href="$href"$classAttribute>$innerHtml</a>'; 1948 return '<a href="$href"$classAttribute>$innerHtml</a>';
1906 } 1949 }
1907 } 1950 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | pkg/analyzer/lib/src/task/driver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698