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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 2281
2282 @override 2282 @override
2283 ht.HtmlUnit parseHtmlUnit(Source source) => 2283 ht.HtmlUnit parseHtmlUnit(Source source) =>
2284 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null); 2284 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null);
2285 2285
2286 @override 2286 @override
2287 AnalysisResult performAnalysisTask() { 2287 AnalysisResult performAnalysisTask() {
2288 if (_TRACE_PERFORM_TASK) { 2288 if (_TRACE_PERFORM_TASK) {
2289 print("----------------------------------------"); 2289 print("----------------------------------------");
2290 } 2290 }
2291 int getStart = JavaSystem.currentTimeMillis(); 2291 PerformanceTag prevTag = PerformanceStatistics.performAnaysis.makeCurrent();
2292 AnalysisTask task = nextAnalysisTask; 2292 try {
2293 int getEnd = JavaSystem.currentTimeMillis(); 2293 int getStart = JavaSystem.currentTimeMillis();
2294 if (task == null && _validateCacheConsistency()) { 2294 AnalysisTask task = nextAnalysisTask;
2295 task = nextAnalysisTask; 2295 int getEnd = JavaSystem.currentTimeMillis();
2296 } 2296 if (task == null && _validateCacheConsistency()) {
2297 if (task == null) { 2297 task = nextAnalysisTask;
2298 _validateLastIncrementalResolutionResult(); 2298 }
2299 if (_performAnalysisTaskStopwatch != null) { 2299 if (task == null) {
2300 AnalysisEngine.instance.instrumentationService.logPerformance( 2300 _validateLastIncrementalResolutionResult();
2301 AnalysisPerformanceKind.FULL, 2301 if (_performAnalysisTaskStopwatch != null) {
2302 _performAnalysisTaskStopwatch, 2302 AnalysisEngine.instance.instrumentationService.logPerformance(
2303 'context_id=$_id'); 2303 AnalysisPerformanceKind.FULL,
2304 _performAnalysisTaskStopwatch = null; 2304 _performAnalysisTaskStopwatch,
2305 'context_id=$_id');
2306 _performAnalysisTaskStopwatch = null;
2307 }
2308 return new AnalysisResult(
2309 _getChangeNotices(true),
2310 getEnd - getStart,
2311 null,
2312 -1);
2313 }
2314 if (_performAnalysisTaskStopwatch == null) {
2315 _performAnalysisTaskStopwatch = new Stopwatch()..start();
2316 }
2317 String taskDescription = task.toString();
2318 _notifyAboutToPerformTask(taskDescription);
2319 if (_TRACE_PERFORM_TASK) {
2320 print(taskDescription);
2321 }
2322 int performStart = JavaSystem.currentTimeMillis();
2323 try {
2324 task.perform(_resultRecorder);
2325 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
2326 AnalysisEngine.instance.logger.logInformation(
2327 "Could not perform analysis task: $taskDescription",
2328 new CaughtException(exception, stackTrace));
2329 } on AnalysisException catch (exception, stackTrace) {
2330 if (exception.cause is! JavaIOException) {
2331 AnalysisEngine.instance.logger.logError(
2332 "Internal error while performing the task: $task",
2333 new CaughtException(exception, stackTrace));
2334 }
2335 }
2336 int performEnd = JavaSystem.currentTimeMillis();
2337 List<ChangeNotice> notices = _getChangeNotices(false);
2338 int noticeCount = notices.length;
2339 for (int i = 0; i < noticeCount; i++) {
2340 ChangeNotice notice = notices[i];
2341 Source source = notice.source;
2342 // TODO(brianwilkerson) Figure out whether the compilation unit is
2343 // always resolved, or whether we need to decide whether to invoke the
2344 // "parsed" or "resolved" method. This might be better done when
2345 // recording task results in order to reduce the chance of errors.
2346 // if (notice.getCompilationUnit() != null) {
2347 // notifyResolvedDart(source, notice.getCompilationUnit());
2348 // } else if (notice.getHtmlUnit() != null) {
2349 // notifyResolvedHtml(source, notice.getHtmlUnit());
2350 // }
2351 _notifyErrors(source, notice.errors, notice.lineInfo);
2305 } 2352 }
2306 return new AnalysisResult( 2353 return new AnalysisResult(
2307 _getChangeNotices(true), 2354 notices,
2308 getEnd - getStart, 2355 getEnd - getStart,
2309 null, 2356 task.runtimeType.toString(),
2310 -1); 2357 performEnd - performStart);
2358 } finally {
2359 prevTag.makeCurrent();
2311 } 2360 }
2312 if (_performAnalysisTaskStopwatch == null) {
2313 _performAnalysisTaskStopwatch = new Stopwatch()..start();
2314 }
2315 String taskDescription = task.toString();
2316 _notifyAboutToPerformTask(taskDescription);
2317 if (_TRACE_PERFORM_TASK) {
2318 print(taskDescription);
2319 }
2320 int performStart = JavaSystem.currentTimeMillis();
2321 try {
2322 task.perform(_resultRecorder);
2323 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
2324 AnalysisEngine.instance.logger.logInformation(
2325 "Could not perform analysis task: $taskDescription",
2326 new CaughtException(exception, stackTrace));
2327 } on AnalysisException catch (exception, stackTrace) {
2328 if (exception.cause is! JavaIOException) {
2329 AnalysisEngine.instance.logger.logError(
2330 "Internal error while performing the task: $task",
2331 new CaughtException(exception, stackTrace));
2332 }
2333 }
2334 int performEnd = JavaSystem.currentTimeMillis();
2335 List<ChangeNotice> notices = _getChangeNotices(false);
2336 int noticeCount = notices.length;
2337 for (int i = 0; i < noticeCount; i++) {
2338 ChangeNotice notice = notices[i];
2339 Source source = notice.source;
2340
2341 // TODO(brianwilkerson) Figure out whether the compilation unit is always
2342 // resolved, or whether we need to decide whether to invoke the "parsed"
2343 // or "resolved" method. This might be better done when recording task
2344 // results in order to reduce the chance of errors.
2345 // if (notice.getCompilationUnit() != null) {
2346 // notifyResolvedDart(source, notice.getCompilationUnit());
2347 // } else if (notice.getHtmlUnit() != null) {
2348 // notifyResolvedHtml(source, notice.getHtmlUnit());
2349 // }
2350 _notifyErrors(source, notice.errors, notice.lineInfo);
2351 }
2352 return new AnalysisResult(
2353 notices,
2354 getEnd - getStart,
2355 task.runtimeType.toString(),
2356 performEnd - performStart);
2357 } 2361 }
2358 2362
2359 @override 2363 @override
2360 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { 2364 void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
2361 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); 2365 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML);
2362 elementMap.forEach((Source librarySource, LibraryElement library) { 2366 elementMap.forEach((Source librarySource, LibraryElement library) {
2363 // 2367 //
2364 // Cache the element in the library's info. 2368 // Cache the element in the library's info.
2365 // 2369 //
2366 DartEntry dartEntry = _getReadableDartEntry(librarySource); 2370 DartEntry dartEntry = _getReadableDartEntry(librarySource);
(...skipping 8148 matching lines...) Expand 10 before | Expand all | Expand 10 after
10515 10519
10516 /** 10520 /**
10517 * The [PerformanceTag] for time spent in linting. 10521 * The [PerformanceTag] for time spent in linting.
10518 */ 10522 */
10519 static PerformanceTag lint = new PerformanceTag('lint'); 10523 static PerformanceTag lint = new PerformanceTag('lint');
10520 10524
10521 /** 10525 /**
10522 * The [PerformanceTag] for time spent computing cycles. 10526 * The [PerformanceTag] for time spent computing cycles.
10523 */ 10527 */
10524 static PerformanceTag cycles = new PerformanceTag('cycles'); 10528 static PerformanceTag cycles = new PerformanceTag('cycles');
10529
10530 /**
10531 * The [PerformanceTag] for time spent in other phases of analysis.
10532 */
10533 static PerformanceTag performAnaysis = new PerformanceTag('performAnaysis');
10525 } 10534 }
10526 10535
10527 /** 10536 /**
10528 * Instances of the class `RecordingErrorListener` implement an error listener t hat will 10537 * Instances of the class `RecordingErrorListener` implement an error listener t hat will
10529 * record the errors that are reported to it in a way that is appropriate for ca ching those errors 10538 * record the errors that are reported to it in a way that is appropriate for ca ching those errors
10530 * within an analysis context. 10539 * within an analysis context.
10531 */ 10540 */
10532 class RecordingErrorListener implements AnalysisErrorListener { 10541 class RecordingErrorListener implements AnalysisErrorListener {
10533 /** 10542 /**
10534 * A HashMap of lists containing the errors that were collected, keyed by each [Source]. 10543 * A HashMap of lists containing the errors that were collected, keyed by each [Source].
(...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after
12429 if (element.id == _id) { 12438 if (element.id == _id) {
12430 result = element; 12439 result = element;
12431 throw new _ElementByIdFinderException(); 12440 throw new _ElementByIdFinderException();
12432 } 12441 }
12433 super.visitElement(element); 12442 super.visitElement(element);
12434 } 12443 }
12435 } 12444 }
12436 12445
12437 class _ElementByIdFinderException { 12446 class _ElementByIdFinderException {
12438 } 12447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698