| 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.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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 writeRow(PerformanceStatistics.io, 'io'); |
| 280 writeRow(PerformanceStatistics.scan, 'scan'); | 280 writeRow(PerformanceStatistics.scan, 'scan'); |
| 281 writeRow(PerformanceStatistics.parse, 'parse'); | 281 writeRow(PerformanceStatistics.parse, 'parse'); |
| 282 writeRow(PerformanceStatistics.resolve, 'resolve'); | 282 writeRow(PerformanceStatistics.resolve, 'resolve'); |
| 283 writeRow(PerformanceStatistics.errors, 'errors'); | 283 writeRow(PerformanceStatistics.errors, 'errors'); |
| 284 writeRow(PerformanceStatistics.hints, 'hints'); | 284 writeRow(PerformanceStatistics.hints, 'hints'); |
| 285 writeRow(PerformanceStatistics.lint, 'lint'); | 285 writeRow(PerformanceStatistics.lint, 'lint'); |
| 286 buffer.write('</table>'); | 286 buffer.write('</table>'); |
| 287 | 287 |
| 288 Map<DataDescriptor, int> countMap = SourceEntry.unflushedCountMap; | 288 Map<DataDescriptor, Map<CacheState, int>> transitionMap = SourceEntry.tr
ansitionMap; |
| 289 buffer.write('<p><b>Number of times flushed data was re-created</b></p>'
); | 289 buffer.write('<p><b>Number of times a state transitioned to VALID (group
ed by descriptor)</b></p>'); |
| 290 if (countMap.isEmpty) { | 290 if (transitionMap.isEmpty) { |
| 291 buffer.write('<p>none</p>'); | 291 buffer.write('<p>none</p>'); |
| 292 } else { | 292 } else { |
| 293 List<DataDescriptor> keys = countMap.keys.toList(); | 293 List<DataDescriptor> descriptors = transitionMap.keys.toList(); |
| 294 keys.sort( | 294 descriptors.sort( |
| 295 (DataDescriptor first, DataDescriptor second) => | 295 (DataDescriptor first, DataDescriptor second) => |
| 296 first.toString().compareTo(second.toString())); | 296 first.toString().compareTo(second.toString())); |
| 297 buffer.write( | 297 for (DataDescriptor key in descriptors) { |
| 298 '<table style="border-collapse: separate; border-spacing: 10px 5px
;">'); | 298 Map<CacheState, int> countMap = transitionMap[key]; |
| 299 _writeRow(buffer, ['Count', 'Data'], header: true); | 299 List<CacheState> oldStates = countMap.keys.toList(); |
| 300 for (DataDescriptor key in keys) { | 300 oldStates.sort( |
| 301 _writeRow( | 301 (CacheState first, CacheState second) => |
| 302 buffer, | 302 first.toString().compareTo(second.toString())); |
| 303 [countMap[key], key.toString()], | 303 buffer.write('<p>${key.toString()}</p>'); |
| 304 classes: ["right", null]); | 304 buffer.write( |
| 305 '<table style="border-collapse: separate; border-spacing: 10px 5
px;">'); |
| 306 _writeRow(buffer, ['Count', 'Previous State'], header: true); |
| 307 for (CacheState state in oldStates) { |
| 308 _writeRow( |
| 309 buffer, |
| 310 [countMap[state], state.toString()], |
| 311 classes: ["right", null]); |
| 312 } |
| 313 buffer.write('</table>'); |
| 305 } | 314 } |
| 306 buffer.write('</table>'); | |
| 307 } | 315 } |
| 308 }); | 316 }); |
| 309 }); | 317 }); |
| 310 } | 318 } |
| 311 | 319 |
| 312 /** | 320 /** |
| 313 * Return a response containing information about an AST structure. | 321 * Return a response containing information about an AST structure. |
| 314 */ | 322 */ |
| 315 void _returnAst(HttpRequest request) { | 323 void _returnAst(HttpRequest request) { |
| 316 AnalysisServer analysisServer = _server.analysisServer; | 324 AnalysisServer analysisServer = _server.analysisServer; |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 * 'error'. | 1630 * 'error'. |
| 1623 */ | 1631 */ |
| 1624 static String makeLink(String path, Map<String, String> params, | 1632 static String makeLink(String path, Map<String, String> params, |
| 1625 String innerHtml, [bool hasError = false]) { | 1633 String innerHtml, [bool hasError = false]) { |
| 1626 Uri uri = new Uri(path: path, queryParameters: params); | 1634 Uri uri = new Uri(path: path, queryParameters: params); |
| 1627 String href = HTML_ESCAPE.convert(uri.toString()); | 1635 String href = HTML_ESCAPE.convert(uri.toString()); |
| 1628 String classAttribute = hasError ? ' class="error"' : ''; | 1636 String classAttribute = hasError ? ' class="error"' : ''; |
| 1629 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 1637 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
| 1630 } | 1638 } |
| 1631 } | 1639 } |
| OLD | NEW |