| 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:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:math'; | 10 import 'dart:math'; |
| (...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 }); | 1652 }); |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 void _returnMemoryUsage(HttpRequest request) { | 1655 void _returnMemoryUsage(HttpRequest request) { |
| 1656 _writeResponse(request, (StringBuffer buffer) { | 1656 _writeResponse(request, (StringBuffer buffer) { |
| 1657 _writePage(buffer, 'Analysis Server - Memory Use', [], | 1657 _writePage(buffer, 'Analysis Server - Memory Use', [], |
| 1658 (StringBuffer buffer) { | 1658 (StringBuffer buffer) { |
| 1659 AnalysisServer server = _server.analysisServer; | 1659 AnalysisServer server = _server.analysisServer; |
| 1660 MemoryUseData data = new MemoryUseData(); | 1660 MemoryUseData data = new MemoryUseData(); |
| 1661 data.processAnalysisServer(server); | 1661 data.processAnalysisServer(server); |
| 1662 Map<Type, HashSet> instances = data.instances; | 1662 Map<Type, Set> instances = data.instances; |
| 1663 List<Type> types = instances.keys.toList(); | 1663 List<Type> types = instances.keys.toList(); |
| 1664 types.sort((Type left, Type right) => | 1664 types.sort((Type left, Type right) => |
| 1665 left.toString().compareTo(right.toString())); | 1665 left.toString().compareTo(right.toString())); |
| 1666 | 1666 |
| 1667 buffer.write('<h3>Instance Counts (reachable from contexts)</h3>'); | 1667 buffer.write('<h3>Instance Counts (reachable from contexts)</h3>'); |
| 1668 buffer.write('<table>'); | 1668 buffer.write('<table>'); |
| 1669 _writeRow(buffer, ['Count', 'Class name'], header: true); | 1669 _writeRow(buffer, ['Count', 'Class name'], header: true); |
| 1670 types.forEach((Type type) { | 1670 types.forEach((Type type) { |
| 1671 _writeRow(buffer, [instances[type].length, type], | 1671 _writeRow(buffer, [instances[type].length, type], |
| 1672 classes: ['right', null]); | 1672 classes: ['right', null]); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 */ | 2709 */ |
| 2710 static String makeLink( | 2710 static String makeLink( |
| 2711 String path, Map<String, String> params, String innerHtml, | 2711 String path, Map<String, String> params, String innerHtml, |
| 2712 [bool hasError = false]) { | 2712 [bool hasError = false]) { |
| 2713 Uri uri = new Uri(path: path, queryParameters: params); | 2713 Uri uri = new Uri(path: path, queryParameters: params); |
| 2714 String href = HTML_ESCAPE.convert(uri.toString()); | 2714 String href = HTML_ESCAPE.convert(uri.toString()); |
| 2715 String classAttribute = hasError ? ' class="error"' : ''; | 2715 String classAttribute = hasError ? ' class="error"' : ''; |
| 2716 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 2716 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
| 2717 } | 2717 } |
| 2718 } | 2718 } |
| OLD | NEW |