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

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

Issue 1524413002: Add --x-perf-report flag to the dartanalyzer command (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add a test 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
Index: pkg/analyzer_cli/lib/src/driver.dart
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 34d3728fe2b229928d0e0d4084ffb91428dc7165..9a272c2307a9a3ddcc8d6f611231e9157905db8b 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -25,10 +25,13 @@ import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/sdk_io.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/generated/utilities_general.dart'
+ show PerformanceTag;
import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:analyzer_cli/src/analyzer_impl.dart';
import 'package:analyzer_cli/src/options.dart';
+import 'package:analyzer_cli/src/perf_report.dart';
import 'package:linter/src/plugin/linter_plugin.dart';
import 'package:package_config/discovery.dart' as pkgDiscovery;
import 'package:package_config/packages.dart' show Packages;
@@ -84,6 +87,8 @@ class Driver {
/// Use the given command-line [args] to start this analysis driver.
void start(List<String> args) {
+ int startTime = new DateTime.now().millisecondsSinceEpoch;
+
StringUtilities.INTERNER = new MappedInterner();
_processPlugins();
@@ -107,10 +112,24 @@ class Driver {
exitCode = severity.ordinal;
}
}
+
+ if (options.perfReport != null) {
+ String json = makePerfReport(startTime, currentTimeMillis(), options);
+ new File(options.perfReport).writeAsStringSync(json);
+ }
}
- /// Perform analysis according to the given [options].
ErrorSeverity _analyzeAll(CommandLineOptions options) {
+ return _analyzeAllTag.makeCurrentWhile(() {
+ return _analyzeAllImpl(options);
+ });
+ }
+
+ static final PerformanceTag _analyzeAllTag =
+ new PerformanceTag("Driver._analyzeAll");
+
+ /// Perform analysis according to the given [options].
+ ErrorSeverity _analyzeAllImpl(CommandLineOptions options) {
if (!options.machineFormat) {
outSink.writeln("Analyzing ${options.sourceFiles}...");
}

Powered by Google App Engine
This is Rietveld 408576698