Index: pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart |
index 4987624e24c485b77471c59be6a9b6a5434db4c8..8f5e6ab1cddd121a2f479c678ee1f7fb33df3f72 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart |
@@ -60,13 +60,21 @@ class LibraryAnalyzer { |
* Compute analysis results for all units of the library. |
*/ |
Map<FileState, UnitAnalysisResult> analyze() { |
+ return PerformanceStatistics.analysis.makeCurrentWhile(() { |
+ return _analyze(); |
+ }); |
+ } |
+ |
+ Map<FileState, UnitAnalysisResult> _analyze() { |
Map<FileState, CompilationUnit> units = {}; |
// Parse all files. |
- units[_library] = _parse(_library); |
- for (FileState part in _library.partedFiles) { |
- units[part] = _parse(part); |
- } |
+ PerformanceStatistics.parse.makeCurrentWhile(() { |
+ units[_library] = _parse(_library); |
scheglov
2017/06/04 00:30:44
Most of the work of _parse() is in FileState.parse
devoncarew
2017/06/04 01:45:52
I moved the instrumentation there.
|
+ for (FileState part in _library.partedFiles) { |
+ units[part] = _parse(part); |
+ } |
+ }); |
// Resolve URIs in directives to corresponding sources. |
units.forEach((file, unit) { |
@@ -92,32 +100,38 @@ class LibraryAnalyzer { |
_computeConstants(); |
- units.forEach((file, unit) { |
- _computeVerifyErrors(file, unit); |
+ PerformanceStatistics.errors.makeCurrentWhile(() { |
+ units.forEach((file, unit) { |
+ _computeVerifyErrors(file, unit); |
+ }); |
}); |
if (_analysisOptions.hint) { |
- units.forEach((file, unit) { |
- { |
- var visitor = new GatherUsedLocalElementsVisitor(_libraryElement); |
- unit.accept(visitor); |
- _usedLocalElementsList.add(visitor.usedElements); |
- } |
- { |
- var visitor = |
- new GatherUsedImportedElementsVisitor(_libraryElement); |
- unit.accept(visitor); |
- _usedImportedElementsList.add(visitor.usedElements); |
- } |
- }); |
- units.forEach((file, unit) { |
- _computeHints(file, unit); |
+ PerformanceStatistics.hints.makeCurrentWhile(() { |
+ units.forEach((file, unit) { |
+ { |
+ var visitor = new GatherUsedLocalElementsVisitor(_libraryElement); |
+ unit.accept(visitor); |
+ _usedLocalElementsList.add(visitor.usedElements); |
+ } |
+ { |
+ var visitor = |
+ new GatherUsedImportedElementsVisitor(_libraryElement); |
+ unit.accept(visitor); |
+ _usedImportedElementsList.add(visitor.usedElements); |
+ } |
+ }); |
+ units.forEach((file, unit) { |
+ _computeHints(file, unit); |
+ }); |
}); |
} |
if (_analysisOptions.lint) { |
- units.forEach((file, unit) { |
- _computeLints(file, unit); |
+ PerformanceStatistics.lints.makeCurrentWhile(() { |
+ units.forEach((file, unit) { |
+ _computeLints(file, unit); |
+ }); |
}); |
} |
} finally { |