| OLD | NEW |
| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 507 } |
| 508 for (String typeName in typeNames) { | 508 for (String typeName in typeNames) { |
| 509 _writeRow(buffer, [typeName, typeCounts[typeName]], | 509 _writeRow(buffer, [typeName, typeCounts[typeName]], |
| 510 classes: [null, "right"]); | 510 classes: [null, "right"]); |
| 511 } | 511 } |
| 512 buffer.write('</table>'); | 512 buffer.write('</table>'); |
| 513 }, (StringBuffer buffer) { | 513 }, (StringBuffer buffer) { |
| 514 // | 514 // |
| 515 // Write task model timing information. | 515 // Write task model timing information. |
| 516 // | 516 // |
| 517 buffer.write('<p><b>Task performace data</b></p>'); | 517 buffer.write('<p><b>Task performance data</b></p>'); |
| 518 buffer.write( | 518 buffer.write( |
| 519 '<table style="border-collapse: separate; border-spacing: 10px 5px
;">'); | 519 '<table style="border-collapse: separate; border-spacing: 10px 5px
;">'); |
| 520 _writeRow( | 520 _writeRow( |
| 521 buffer, | 521 buffer, |
| 522 [ | 522 [ |
| 523 'Task Name', | 523 'Task Name', |
| 524 'Count', | 524 'Count', |
| 525 'Total Time (in ms)', | 525 'Total Time (in ms)', |
| 526 'Average Time (in ms)' | 526 'Average Time (in ms)' |
| 527 ], | 527 ], |
| (...skipping 21 matching lines...) Expand all Loading... |
| 549 null, | 549 null, |
| 550 "right", | 550 "right", |
| 551 "right", | 551 "right", |
| 552 "right" | 552 "right" |
| 553 ]); | 553 ]); |
| 554 }); | 554 }); |
| 555 _writeRow(buffer, ['Total', '-', totalTaskTime, '-'], | 555 _writeRow(buffer, ['Total', '-', totalTaskTime, '-'], |
| 556 classes: [null, "right", "right", "right"]); | 556 classes: [null, "right", "right", "right"]); |
| 557 buffer.write('</table>'); | 557 buffer.write('</table>'); |
| 558 }); | 558 }); |
| 559 // | |
| 560 // Write task model inputs timing information. | |
| 561 // | |
| 562 { | |
| 563 buffer.write('<p><b>Task inputs performace data</b></p>'); | |
| 564 buffer.write( | |
| 565 '<table style="border-collapse: separate; border-spacing: 10px 5px
;">'); | |
| 566 _writeRow( | |
| 567 buffer, | |
| 568 [ | |
| 569 'Task Name', | |
| 570 'Count', | |
| 571 'Total Time (in ms)', | |
| 572 'Average Time (in ms)' | |
| 573 ], | |
| 574 header: true); | |
| 575 | |
| 576 Map<TaskDescriptor, int> countMap = WorkItem.countMap; | |
| 577 Map<TaskDescriptor, Stopwatch> stopwatchMap = WorkItem.stopwatchMap; | |
| 578 List<TaskDescriptor> taskClasses = stopwatchMap.keys.toList(); | |
| 579 taskClasses.sort((TaskDescriptor first, TaskDescriptor second) { | |
| 580 String firstName = first.name; | |
| 581 String secondName = second.name; | |
| 582 return firstName.compareTo(secondName); | |
| 583 }); | |
| 584 taskClasses.forEach((TaskDescriptor descriptor) { | |
| 585 int count = countMap[descriptor]; | |
| 586 if (count == null) { | |
| 587 count = 0; | |
| 588 } | |
| 589 int taskTime = stopwatchMap[descriptor].elapsedMilliseconds; | |
| 590 _writeRow(buffer, [ | |
| 591 descriptor.name, | |
| 592 count, | |
| 593 taskTime, | |
| 594 count <= 0 ? '-' : (taskTime / count).toStringAsFixed(3) | |
| 595 ], classes: [ | |
| 596 null, | |
| 597 "right", | |
| 598 "right", | |
| 599 "right" | |
| 600 ]); | |
| 601 }); | |
| 602 buffer.write('</table>'); | |
| 603 } | |
| 604 }); | 559 }); |
| 605 }); | 560 }); |
| 606 } | 561 } |
| 607 | 562 |
| 608 /** | 563 /** |
| 609 * Return a response containing information about an AST structure. | 564 * Return a response containing information about an AST structure. |
| 610 */ | 565 */ |
| 611 void _returnAst(HttpRequest request) { | 566 void _returnAst(HttpRequest request) { |
| 612 AnalysisServer analysisServer = _server.analysisServer; | 567 AnalysisServer analysisServer = _server.analysisServer; |
| 613 if (analysisServer == null) { | 568 if (analysisServer == null) { |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 */ | 1936 */ |
| 1982 static String makeLink( | 1937 static String makeLink( |
| 1983 String path, Map<String, String> params, String innerHtml, | 1938 String path, Map<String, String> params, String innerHtml, |
| 1984 [bool hasError = false]) { | 1939 [bool hasError = false]) { |
| 1985 Uri uri = new Uri(path: path, queryParameters: params); | 1940 Uri uri = new Uri(path: path, queryParameters: params); |
| 1986 String href = HTML_ESCAPE.convert(uri.toString()); | 1941 String href = HTML_ESCAPE.convert(uri.toString()); |
| 1987 String classAttribute = hasError ? ' class="error"' : ''; | 1942 String classAttribute = hasError ? ' class="error"' : ''; |
| 1988 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 1943 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
| 1989 } | 1944 } |
| 1990 } | 1945 } |
| OLD | NEW |