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

Side by Side Diff: pkg/analyzer/lib/src/task/driver.dart

Issue 1161183004: Another tweak for displaying performance. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.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.src.task.driver; 5 library analyzer.src.task.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/context/cache.dart'; 10 import 'package:analyzer/src/context/cache.dart';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
12 hide AnalysisTask, AnalysisContextImpl; 12 hide AnalysisTask, AnalysisContextImpl;
13 import 'package:analyzer/src/generated/java_engine.dart'; 13 import 'package:analyzer/src/generated/java_engine.dart';
14 import 'package:analyzer/src/generated/resolver.dart'; 14 import 'package:analyzer/src/generated/resolver.dart';
15 import 'package:analyzer/src/generated/utilities_general.dart'; 15 import 'package:analyzer/src/generated/utilities_general.dart';
16 import 'package:analyzer/src/task/inputs.dart'; 16 import 'package:analyzer/src/task/inputs.dart';
17 import 'package:analyzer/src/task/manager.dart'; 17 import 'package:analyzer/src/task/manager.dart';
18 import 'package:analyzer/task/model.dart'; 18 import 'package:analyzer/task/model.dart';
19 19
20 final PerformanceTag workOrderMoveNextPerfTag =
21 new PerformanceTag('WorkOrder.moveNext');
22
20 /** 23 /**
21 * An object that is used to cause analysis to be performed until all of the 24 * An object that is used to cause analysis to be performed until all of the
22 * required analysis information has been computed. 25 * required analysis information has been computed.
23 */ 26 */
24 class AnalysisDriver { 27 class AnalysisDriver {
25 /** 28 /**
26 * The task manager used to figure out how to compute analysis results. 29 * The task manager used to figure out how to compute analysis results.
27 */ 30 */
28 final TaskManager taskManager; 31 final TaskManager taskManager;
29 32
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 WorkItem get current { 712 WorkItem get current {
710 if (currentItems == null) { 713 if (currentItems == null) {
711 return null; 714 return null;
712 } else { 715 } else {
713 return currentItems.last; 716 return currentItems.last;
714 } 717 }
715 } 718 }
716 719
717 @override 720 @override
718 bool moveNext() { 721 bool moveNext() {
719 if (currentItems != null && currentItems.length > 1) { 722 return workOrderMoveNextPerfTag.makeCurrentWhile(() {
720 // Yield more items. 723 if (currentItems != null && currentItems.length > 1) {
721 currentItems.removeLast(); 724 // Yield more items.
722 return true; 725 currentItems.removeLast();
723 } else { 726 return true;
724 // Get a new strongly connected component. 727 } else {
725 StronglyConnectedComponent<WorkItem> nextStronglyConnectedComponent = 728 // Get a new strongly connected component.
726 _dependencyWalker.getNextStronglyConnectedComponent(); 729 StronglyConnectedComponent<WorkItem> nextStronglyConnectedComponent =
727 if (nextStronglyConnectedComponent == null) { 730 _dependencyWalker.getNextStronglyConnectedComponent();
728 currentItems = null; 731 if (nextStronglyConnectedComponent == null) {
729 return false; 732 currentItems = null;
733 return false;
734 }
735 currentItems = nextStronglyConnectedComponent.nodes;
736 if (nextStronglyConnectedComponent.containsCycle) {
737 // A cycle has been found.
738 for (WorkItem item in currentItems) {
739 item.dependencyCycle = currentItems.toList();
740 }
741 } else {
742 assert(currentItems.length == 1);
743 }
744 return true;
730 } 745 }
731 currentItems = nextStronglyConnectedComponent.nodes; 746 });
732 if (nextStronglyConnectedComponent.containsCycle) {
733 // A cycle has been found.
734 for (WorkItem item in currentItems) {
735 item.dependencyCycle = currentItems.toList();
736 }
737 } else {
738 assert(currentItems.length == 1);
739 }
740 return true;
741 }
742 } 747 }
743 } 748 }
744 749
745 /** 750 /**
746 * The priorities of work orders returned by [WorkManager]s. 751 * The priorities of work orders returned by [WorkManager]s.
747 */ 752 */
748 enum WorkOrderPriority { 753 enum WorkOrderPriority {
749 /** 754 /**
750 * Responding to an user's action. 755 * Responding to an user's action.
751 */ 756 */
(...skipping 25 matching lines...) Expand all
777 final TaskManager taskManager; 782 final TaskManager taskManager;
778 783
779 _WorkOrderDependencyWalker(this.taskManager, WorkItem startingNode) 784 _WorkOrderDependencyWalker(this.taskManager, WorkItem startingNode)
780 : super(startingNode); 785 : super(startingNode);
781 786
782 @override 787 @override
783 WorkItem getNextInput(WorkItem node, List<WorkItem> skipInputs) { 788 WorkItem getNextInput(WorkItem node, List<WorkItem> skipInputs) {
784 return node.gatherInputs(taskManager, skipInputs); 789 return node.gatherInputs(taskManager, skipInputs);
785 } 790 }
786 } 791 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698