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

Unified Diff: pkg/analyzer_cli/lib/src/perf_report.dart

Issue 1539783002: add tasks to perf report (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/analyzer_cli/lib/src/perf_report.dart
diff --git a/pkg/analyzer_cli/lib/src/perf_report.dart b/pkg/analyzer_cli/lib/src/perf_report.dart
index 03791d8cf78821973c4f3c2cd07d95e392bc2e52..208e56012c1c20103162e787c15db74fe9b83a79 100644
--- a/pkg/analyzer_cli/lib/src/perf_report.dart
+++ b/pkg/analyzer_cli/lib/src/perf_report.dart
@@ -9,6 +9,7 @@ import 'dart:io' show File, Platform;
import 'package:analyzer/src/generated/utilities_general.dart'
show PerformanceTag;
+import 'package:analyzer/task/model.dart' show AnalysisTask;
import 'package:analyzer_cli/src/options.dart' show CommandLineOptions;
const _JSON = const JsonEncoder.withIndent(" ");
@@ -70,13 +71,36 @@ String makePerfReport(int startTime, int endTime, CommandLineOptions options) {
}
perfTagsJson['other'] = otherTime;
- var json = <String, dynamic>{
+ // Generate task table.
+ var taskRows = <_TaskRow>[];
+ int totalTaskTime = 0;
+ for (var key in AnalysisTask.stopwatchMap.keys) {
+ var time = AnalysisTask.stopwatchMap[key].elapsedMilliseconds;
+ if (time == 0) continue;
+ totalTaskTime += time;
+ var count = AnalysisTask.countMap[key];
+ taskRows.add(new _TaskRow(key.toString(), time, count));
+ }
+ taskRows.sort((a, b) => b.time.compareTo(a.time));
+
+ var reportJson = <String, dynamic>{
'perfReportVersion': 0,
'platform': platformJson,
'options': optionsJson,
'totalElapsedTime': totalTime,
- 'performanceTags': perfTagsJson
+ 'totalTaskTime': totalTaskTime,
+ 'performanceTags': perfTagsJson,
+ 'tasks': taskRows.map((r) => r.toJson()).toList(),
};
- return _JSON.convert(json);
+ return _JSON.convert(reportJson);
+}
+
+class _TaskRow {
+ final String name;
+ final int time;
+ final int count;
+ _TaskRow(this.name, this.time, this.count);
+
+ Map toJson() => <String, dynamic>{'name': name, 'time': time, 'count': count};
}
« 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