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

Unified Diff: pkg/analysis_server/lib/src/get_handler.dart

Issue 953933002: Improve performance tags display - percent and sorting. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Show two significant figures after the decimal point. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/get_handler.dart
diff --git a/pkg/analysis_server/lib/src/get_handler.dart b/pkg/analysis_server/lib/src/get_handler.dart
index 095ca77c3ec12fff6d34294e31d13f0459c6eed2..09c2cd4319f9c659c24721e110ea025a53dbd19d 100644
--- a/pkg/analysis_server/lib/src/get_handler.dart
+++ b/pkg/analysis_server/lib/src/get_handler.dart
@@ -267,20 +267,43 @@ class GetHandler {
'Analysis Server - Analysis Performance',
[],
(StringBuffer buffer) {
- void writeRow(PerformanceTag tag) {
- _writeRow(buffer, [tag.elapsedMs, tag.label], classes: ["right", null]);
- }
buffer.write('<h3>Analysis Performance</h3>');
- buffer.write('<p><b>Time spent in each phase of analysis</b></p>');
- buffer.write(
- '<table style="border-collapse: separate; border-spacing: 10px 5px;">');
- _writeRow(buffer, ['Time (in ms)', 'Analysis Phase'], header: true);
- PerformanceTag.all.forEach(writeRow);
- buffer.write('</table>');
- Map<DataDescriptor, Map<CacheState, int>> transitionMap = SourceEntry.transitionMap;
- buffer.write('<p><b>Number of times a state transitioned to VALID (grouped by descriptor)</b></p>');
+ {
+ buffer.write('<p><b>Time spent in each phase of analysis</b></p>');
+ buffer.write(
+ '<table style="border-collapse: separate; border-spacing: 10px 5px;">');
+ _writeRow(
+ buffer,
+ ['Time (in ms)', 'Percent', 'Analysis Phase'],
+ header: true);
+ // prepare sorted tags
+ List<PerformanceTag> tags = PerformanceTag.all.toList();
+ tags.remove(ServerPerformanceStatistics.idle);
+ tags.sort((a, b) => b.elapsedMs - a.elapsedMs);
+ // prepare total time
+ int totalTime = 0;
+ tags.forEach((PerformanceTag tag) {
+ totalTime += tag.elapsedMs;
+ });
+ // write rows
+ void writeRow(PerformanceTag tag) {
+ double percent = (tag.elapsedMs * 100) / totalTime;
+ String percentStr = '${percent.toStringAsFixed(2)}%';
+ _writeRow(
+ buffer,
+ [tag.elapsedMs, percentStr, tag.label],
+ classes: ["right", "right", null]);
+ }
+ tags.forEach(writeRow);
+ buffer.write('</table>');
+ }
+
+ Map<DataDescriptor, Map<CacheState, int>> transitionMap =
+ SourceEntry.transitionMap;
+ buffer.write(
+ '<p><b>Number of times a state transitioned to VALID (grouped by descriptor)</b></p>');
if (transitionMap.isEmpty) {
buffer.write('<p>none</p>');
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698