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

Side by Side Diff: pkg/analyzer/lib/src/generated/utilities_general.dart

Issue 2917183003: update the analyzer and analysis server perf tags (Closed)
Patch Set: updates for review comments Created 3 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
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 library analyzer.src.generated.utilities_general; 5 library analyzer.src.generated.utilities_general;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:developer' show UserTag; 8 import 'dart:developer' show UserTag;
9 9
10 export 'package:front_end/src/base/jenkins_smi_hash.dart' show JenkinsSmiHash; 10 export 'package:front_end/src/base/jenkins_smi_hash.dart' show JenkinsSmiHash;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 /** 85 /**
86 * Return the current [PerformanceTag] for the isolate. 86 * Return the current [PerformanceTag] for the isolate.
87 */ 87 */
88 static PerformanceTag get current => _PerformanceTagImpl.current; 88 static PerformanceTag get current => _PerformanceTagImpl.current;
89 89
90 /** 90 /**
91 * Return the [PerformanceTag] that is initially current. This is intended 91 * Return the [PerformanceTag] that is initially current. This is intended
92 * to track time when the system is performing unknown operations. 92 * to track time when the system is performing unknown operations.
93 */ 93 */
94 static PerformanceTag get UNKNOWN => _PerformanceTagImpl.UNKNOWN; 94 static PerformanceTag get unknown => _PerformanceTagImpl.unknown;
95 95
96 /** 96 /**
97 * Create a [PerformanceTag] having the given [label]. A [UserTag] will also 97 * Create a [PerformanceTag] having the given [label]. A [UserTag] will also
98 * be created, having the same [label], so that performance information can 98 * be created, having the same [label], so that performance information can
99 * be queried using the observatory. 99 * be queried using the observatory.
100 */ 100 */
101 factory PerformanceTag(String label) = _PerformanceTagImpl; 101 factory PerformanceTag(String label) = _PerformanceTagImpl;
102 102
103 /** 103 /**
104 * Return the total number of milliseconds that this [PerformanceTag] has 104 * Return the total number of milliseconds that this [PerformanceTag] has
105 * been the current [PerformanceTag] for the isolate. 105 * been the current [PerformanceTag] for the isolate.
106 * 106 *
107 * This call is safe even if this [PerformanceTag] is current. 107 * This call is safe even if this [PerformanceTag] is current.
108 */ 108 */
109 int get elapsedMs; 109 int get elapsedMs;
110 110
111 /** 111 /**
112 * Return the label for this [PerformanceTag]. 112 * Return the label for this [PerformanceTag].
113 */ 113 */
114 String get label; 114 String get label;
115 115
116 /** 116 /**
117 * Create a child tag of the current tag. The new tag's name will include the
118 * parent's name.
119 */
120 PerformanceTag createChild(String childTagName);
121
122 /**
117 * Make this the current tag for the isolate, and return the previous tag. 123 * Make this the current tag for the isolate, and return the previous tag.
118 */ 124 */
119 PerformanceTag makeCurrent(); 125 PerformanceTag makeCurrent();
120 126
121 /** 127 /**
122 * Make this the current tag for the isolate, run [f], and restore the 128 * Make this the current tag for the isolate, run [f], and restore the
123 * previous tag. Returns the result of invoking [f]. 129 * previous tag. Returns the result of invoking [f].
124 */ 130 */
125 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()); 131 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f());
126 132
127 /** 133 /**
128 * Reset the total time tracked by all [PerformanceTag]s to zero. 134 * Reset the total time tracked by all [PerformanceTag]s to zero.
129 */ 135 */
130 static void reset() { 136 static void reset() {
131 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) { 137 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) {
132 tag.stopwatch.reset(); 138 tag.stopwatch.reset();
133 } 139 }
134 } 140 }
135 } 141 }
136 142
137 class _PerformanceTagImpl implements PerformanceTag { 143 class _PerformanceTagImpl implements PerformanceTag {
138 /** 144 /**
139 * The current performance tag for the isolate. 145 * The current performance tag for the isolate.
140 */ 146 */
141 static _PerformanceTagImpl current = UNKNOWN; 147 static _PerformanceTagImpl current = unknown;
142 148
143 static final _PerformanceTagImpl UNKNOWN = new _PerformanceTagImpl('unknown'); 149 static final _PerformanceTagImpl unknown = new _PerformanceTagImpl('unknown');
144 150
145 /** 151 /**
146 * A list of all performance tags that have been created so far. 152 * A list of all performance tags that have been created so far.
147 */ 153 */
148 static List<_PerformanceTagImpl> all = <_PerformanceTagImpl>[]; 154 static List<_PerformanceTagImpl> all = <_PerformanceTagImpl>[];
149 155
150 /** 156 /**
151 * The [UserTag] associated with this [PerformanceTag]. 157 * The [UserTag] associated with this [PerformanceTag].
152 */ 158 */
153 final UserTag userTag; 159 final UserTag userTag;
(...skipping 10 matching lines...) Expand all
164 all.add(this); 170 all.add(this);
165 } 171 }
166 172
167 @override 173 @override
168 int get elapsedMs => stopwatch.elapsedMilliseconds; 174 int get elapsedMs => stopwatch.elapsedMilliseconds;
169 175
170 @override 176 @override
171 String get label => userTag.label; 177 String get label => userTag.label;
172 178
173 @override 179 @override
180 PerformanceTag createChild(String childTagName) {
181 return new _PerformanceTagImpl('$label.$childTagName');
182 }
183
184 @override
174 PerformanceTag makeCurrent() { 185 PerformanceTag makeCurrent() {
175 if (identical(this, current)) { 186 if (identical(this, current)) {
176 return current; 187 return current;
177 } 188 }
178 _PerformanceTagImpl previous = current; 189 _PerformanceTagImpl previous = current;
179 previous.stopwatch.stop(); 190 previous.stopwatch.stop();
180 stopwatch.start(); 191 stopwatch.start();
181 current = this; 192 current = this;
182 userTag.makeCurrent(); 193 userTag.makeCurrent();
183 return previous; 194 return previous;
184 } 195 }
185 196
186 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()) { 197 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()) {
187 PerformanceTag prevTag = makeCurrent(); 198 PerformanceTag prevTag = makeCurrent();
188 try { 199 try {
189 return f(); 200 return f();
190 } finally { 201 } finally {
191 prevTag.makeCurrent(); 202 prevTag.makeCurrent();
192 } 203 }
193 } 204 }
194 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698