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

Side by Side Diff: pkg/analyzer/lib/task/model.dart

Issue 1420783004: Last performed task diagnostics. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Label. Created 5 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_general.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.task.model; 5 library analyzer.task.model;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:developer'; 8 import 'dart:developer';
9 9
10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; 10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 /** 74 /**
75 * An object used to compute one or more analysis results associated with a 75 * An object used to compute one or more analysis results associated with a
76 * single target. 76 * single target.
77 * 77 *
78 * Clients must extend this class when creating new tasks. 78 * Clients must extend this class when creating new tasks.
79 */ 79 */
80 abstract class AnalysisTask { 80 abstract class AnalysisTask {
81 /** 81 /**
82 * A queue storing the last 10 task descriptions for diagnostic purposes.
83 */
84 static final LimitedQueue<String> LAST_TASKS = new LimitedQueue<String>(10);
85
86 /**
82 * A table mapping the types of analysis tasks to the number of times each 87 * A table mapping the types of analysis tasks to the number of times each
83 * kind of task has been performed. 88 * kind of task has been performed.
84 */ 89 */
85 static final Map<Type, int> countMap = new HashMap<Type, int>(); 90 static final Map<Type, int> countMap = new HashMap<Type, int>();
86 91
87 /** 92 /**
88 * A table mapping the types of analysis tasks to user tags used to collect 93 * A table mapping the types of analysis tasks to user tags used to collect
89 * timing data for the Observatory. 94 * timing data for the Observatory.
90 */ 95 */
91 static Map<Type, UserTag> tagMap = new HashMap<Type, UserTag>(); 96 static Map<Type, UserTag> tagMap = new HashMap<Type, UserTag>();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 264
260 /** 265 /**
261 * Perform this analysis task, ensuring that all exceptions are wrapped in an 266 * Perform this analysis task, ensuring that all exceptions are wrapped in an
262 * [AnalysisException]. 267 * [AnalysisException].
263 * 268 *
264 * Clients may not override this method. 269 * Clients may not override this method.
265 */ 270 */
266 void _safelyPerform() { 271 void _safelyPerform() {
267 try { 272 try {
268 // 273 //
274 // Store task description for diagnostics.
275 //
276 LAST_TASKS.add(description);
277
278 //
269 // Report that this task is being performed. 279 // Report that this task is being performed.
270 // 280 //
271 String contextName = context.name; 281 String contextName = context.name;
272 if (contextName == null) { 282 if (contextName == null) {
273 contextName = 'unnamed'; 283 contextName = 'unnamed';
274 } 284 }
275 AnalysisEngine.instance.instrumentationService 285 AnalysisEngine.instance.instrumentationService
276 .logAnalysisTask(contextName, this); 286 .logAnalysisTask(contextName, this);
277 // 287 //
278 // Gather statistics on the performance of the task. 288 // Gather statistics on the performance of the task.
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 /** 735 /**
726 * A work should be done, but without any special urgency. 736 * A work should be done, but without any special urgency.
727 */ 737 */
728 NORMAL, 738 NORMAL,
729 739
730 /** 740 /**
731 * Nothing to do. 741 * Nothing to do.
732 */ 742 */
733 NONE 743 NONE
734 } 744 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_general.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698