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

Unified Diff: pkg/analyzer_cli/lib/src/analyzer_impl.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
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/driver.dart » ('j') | pkg/analyzer_cli/lib/src/perf_report.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index d54178e5663d67b90adea189c38ee3f4a371b00d..1add1e58c8e3d1c8b019a0a100ad98053f54b185 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -122,13 +122,17 @@ class AnalyzerImpl {
/// Fills [errorInfos] using [sources].
void prepareErrors() {
- for (Source source in sources) {
- context.computeErrors(source);
-
- errorInfos.add(context.getErrors(source));
- }
+ return _prepareErrorsTag.makeCurrentWhile(() {
+ for (Source source in sources) {
+ context.computeErrors(source);
+ errorInfos.add(context.getErrors(source));
+ }
+ });
}
+ static final PerformanceTag _prepareErrorsTag =
+ new PerformanceTag("AnalyzerImpl.prepareErrors");
+
/// Fills [sources].
void prepareSources(LibraryElement library) {
var units = new Set<CompilationUnitElement>();
@@ -155,15 +159,13 @@ class AnalyzerImpl {
"${librarySource.fullName} is a part and can not be analyzed.");
return ErrorSeverity.ERROR;
}
- // Resolve library.
- var libraryElement = context.computeLibraryElement(librarySource);
- // Prepare source and errors.
+ var libraryElement = _resolveLibrary();
prepareSources(libraryElement);
prepareErrors();
// Print errors and performance numbers.
if (printMode == 1) {
- _printErrorsAndPerf();
+ _printErrors();
} else if (printMode == 2) {
_printColdPerf();
}
@@ -205,7 +207,7 @@ class AnalyzerImpl {
outSink.writeln("total-cold:$totalTime");
}
- _printErrorsAndPerf() {
+ _printErrors() {
// The following is a hack. We currently print out to stderr to ensure that
// when in batch mode we print to stderr, this is because the prints from
// batch are made to stderr. The reason that options.shouldBatch isn't used
@@ -249,6 +251,15 @@ class AnalyzerImpl {
return new ProcessedSeverity(severity, isOverridden);
}
+ LibraryElement _resolveLibrary() {
+ return _resolveLibraryTag.makeCurrentWhile(() {
+ return context.computeLibraryElement(librarySource);
+ });
+ }
+
+ static final PerformanceTag _resolveLibraryTag =
+ new PerformanceTag("AnalyzerImpl._resolveLibrary");
+
/// Compute the severity of the error; however:
/// * if [options.enableTypeChecks] is false, then de-escalate checked-mode
/// compile time errors to a severity of [ErrorSeverity.INFO].
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/driver.dart » ('j') | pkg/analyzer_cli/lib/src/perf_report.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698