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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 844683003: Report incremental/full analysis performance via instrumentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « pkg/analyzer/lib/instrumentation/instrumentation.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 6a5abf0a405637306f966f4084a5b100fd179483..53cd19c664e48b9110942d128136410bd91feb61 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -921,6 +921,16 @@ class AnalysisContextImpl implements InternalAnalysisContext {
static bool _TRACE_PERFORM_TASK = false;
/**
+ * The next context identifier.
+ */
+ static int _NEXT_ID = 0;
+
+ /**
+ * The unique identifier of this context.
+ */
+ final int _id = _NEXT_ID++;
+
+ /**
* The set of analysis options controlling the behavior of this context.
*/
AnalysisOptionsImpl _options = new AnalysisOptionsImpl();
@@ -1016,6 +1026,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
WorkManager _workManager = new WorkManager();
/**
+ * The [Stopwatch] of the current "perform tasks cycle".
+ */
+ Stopwatch _performAnalysisTaskStopwatch;
+
+ /**
* The controller for sending [SourcesChangedEvent]s.
*/
StreamController<SourcesChangedEvent> _onSourcesChangedController;
@@ -2175,12 +2190,22 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
if (task == null) {
_validateLastIncrementalResolutionResult();
+ if (_performAnalysisTaskStopwatch != null) {
+ AnalysisEngine.instance.instrumentationService.logPerformance(
+ AnalysisPerformanceKind.FULL,
+ _performAnalysisTaskStopwatch,
+ 'context_id=$_id');
+ _performAnalysisTaskStopwatch = null;
+ }
return new AnalysisResult(
_getChangeNotices(true),
getEnd - getStart,
null,
-1);
}
+ if (_performAnalysisTaskStopwatch == null) {
+ _performAnalysisTaskStopwatch = new Stopwatch()..start();
+ }
String taskDescription = task.toString();
_notifyAboutToPerformTask(taskDescription);
if (_TRACE_PERFORM_TASK) {
@@ -2235,10 +2260,13 @@ class AnalysisContextImpl implements InternalAnalysisContext {
incrementalResolutionValidation_lastLibrarySource);
if (fullUnit != null) {
try {
- assertSameResolution(incrementalResolutionValidation_lastUnit, fullUnit);
+ assertSameResolution(
+ incrementalResolutionValidation_lastUnit,
+ fullUnit);
} on IncrementalResolutionMismatch catch (mismatch, stack) {
String failure = mismatch.message;
- String message = 'Incremental resolution mismatch:\n$failure\nat\n$stack';
+ String message =
+ 'Incremental resolution mismatch:\n$failure\nat\n$stack';
AnalysisEngine.instance.logger.logError(message);
}
}
@@ -4983,19 +5011,25 @@ class AnalysisContextImpl implements InternalAnalysisContext {
return false;
}
// do resolution
+ Stopwatch perfCounter = new Stopwatch()..start();
PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
typeProvider,
unitSource,
dartEntry,
analysisOptions.incrementalApi);
bool success = resolver.resolve(oldUnit, newCode);
+ AnalysisEngine.instance.instrumentationService.logPerformance(
+ AnalysisPerformanceKind.INCREMENTAL,
+ perfCounter,
+ 'success=$success,context_id=$_id,code_length=${newCode.length}');
if (!success) {
return false;
}
// if validation, remember the result, but throw it away
if (analysisOptions.incrementalValidation) {
incrementalResolutionValidation_lastUnitSource = oldUnit.element.source;
- incrementalResolutionValidation_lastLibrarySource = oldUnit.element.library.source;
+ incrementalResolutionValidation_lastLibrarySource =
+ oldUnit.element.library.source;
incrementalResolutionValidation_lastUnit = oldUnit;
return false;
}
« no previous file with comments | « pkg/analyzer/lib/instrumentation/instrumentation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698