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

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

Issue 951423002: Add more performance tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
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 a3d434a5ed417f76068b02a2a5761c288f4b5002..ab72d9f9a6c9e888bc929ef01724286551730703 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -2288,72 +2288,76 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (_TRACE_PERFORM_TASK) {
print("----------------------------------------");
}
- int getStart = JavaSystem.currentTimeMillis();
- AnalysisTask task = nextAnalysisTask;
- int getEnd = JavaSystem.currentTimeMillis();
- if (task == null && _validateCacheConsistency()) {
- task = nextAnalysisTask;
- }
- 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) {
- print(taskDescription);
- }
- int performStart = JavaSystem.currentTimeMillis();
+ PerformanceTag prevTag = PerformanceStatistics.performAnaysis.makeCurrent();
try {
- task.perform(_resultRecorder);
- } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
- AnalysisEngine.instance.logger.logInformation(
- "Could not perform analysis task: $taskDescription",
- new CaughtException(exception, stackTrace));
- } on AnalysisException catch (exception, stackTrace) {
- if (exception.cause is! JavaIOException) {
- AnalysisEngine.instance.logger.logError(
- "Internal error while performing the task: $task",
+ int getStart = JavaSystem.currentTimeMillis();
+ AnalysisTask task = nextAnalysisTask;
+ int getEnd = JavaSystem.currentTimeMillis();
+ if (task == null && _validateCacheConsistency()) {
+ task = nextAnalysisTask;
+ }
+ 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) {
+ print(taskDescription);
+ }
+ int performStart = JavaSystem.currentTimeMillis();
+ try {
+ task.perform(_resultRecorder);
+ } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
+ AnalysisEngine.instance.logger.logInformation(
+ "Could not perform analysis task: $taskDescription",
new CaughtException(exception, stackTrace));
+ } on AnalysisException catch (exception, stackTrace) {
+ if (exception.cause is! JavaIOException) {
+ AnalysisEngine.instance.logger.logError(
+ "Internal error while performing the task: $task",
+ new CaughtException(exception, stackTrace));
+ }
}
+ int performEnd = JavaSystem.currentTimeMillis();
+ List<ChangeNotice> notices = _getChangeNotices(false);
+ int noticeCount = notices.length;
+ for (int i = 0; i < noticeCount; i++) {
+ ChangeNotice notice = notices[i];
+ Source source = notice.source;
+ // TODO(brianwilkerson) Figure out whether the compilation unit is
+ // always resolved, or whether we need to decide whether to invoke the
+ // "parsed" or "resolved" method. This might be better done when
+ // recording task results in order to reduce the chance of errors.
+// if (notice.getCompilationUnit() != null) {
+// notifyResolvedDart(source, notice.getCompilationUnit());
+// } else if (notice.getHtmlUnit() != null) {
+// notifyResolvedHtml(source, notice.getHtmlUnit());
+// }
+ _notifyErrors(source, notice.errors, notice.lineInfo);
+ }
+ return new AnalysisResult(
+ notices,
+ getEnd - getStart,
+ task.runtimeType.toString(),
+ performEnd - performStart);
+ } finally {
+ prevTag.makeCurrent();
}
- int performEnd = JavaSystem.currentTimeMillis();
- List<ChangeNotice> notices = _getChangeNotices(false);
- int noticeCount = notices.length;
- for (int i = 0; i < noticeCount; i++) {
- ChangeNotice notice = notices[i];
- Source source = notice.source;
-
- // TODO(brianwilkerson) Figure out whether the compilation unit is always
- // resolved, or whether we need to decide whether to invoke the "parsed"
- // or "resolved" method. This might be better done when recording task
- // results in order to reduce the chance of errors.
- // if (notice.getCompilationUnit() != null) {
- // notifyResolvedDart(source, notice.getCompilationUnit());
- // } else if (notice.getHtmlUnit() != null) {
- // notifyResolvedHtml(source, notice.getHtmlUnit());
- // }
- _notifyErrors(source, notice.errors, notice.lineInfo);
- }
- return new AnalysisResult(
- notices,
- getEnd - getStart,
- task.runtimeType.toString(),
- performEnd - performStart);
}
@override
@@ -10522,6 +10526,11 @@ class PerformanceStatistics {
* The [PerformanceTag] for time spent computing cycles.
*/
static PerformanceTag cycles = new PerformanceTag('cycles');
+
+ /**
+ * The [PerformanceTag] for time spent in other phases of analysis.
+ */
+ static PerformanceTag performAnaysis = new PerformanceTag('performAnaysis');
}
/**

Powered by Google App Engine
This is Rietveld 408576698