OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 /** | 122 /** |
123 * 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. |
124 */ | 124 */ |
125 PerformanceTag makeCurrent(); | 125 PerformanceTag makeCurrent(); |
126 | 126 |
127 /** | 127 /** |
128 * 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 |
129 * previous tag. Returns the result of invoking [f]. | 129 * previous tag. Returns the result of invoking [f]. |
130 */ | 130 */ |
131 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()); | 131 E makeCurrentWhile<E>(E f()); |
132 | 132 |
133 /** | 133 /** |
134 * Reset the total time tracked by all [PerformanceTag]s to zero. | 134 * Reset the total time tracked by all [PerformanceTag]s to zero. |
135 */ | 135 */ |
136 static void reset() { | 136 static void reset() { |
137 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) { | 137 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) { |
138 tag.stopwatch.reset(); | 138 tag.stopwatch.reset(); |
139 } | 139 } |
140 } | 140 } |
141 } | 141 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return current; | 187 return current; |
188 } | 188 } |
189 _PerformanceTagImpl previous = current; | 189 _PerformanceTagImpl previous = current; |
190 previous.stopwatch.stop(); | 190 previous.stopwatch.stop(); |
191 stopwatch.start(); | 191 stopwatch.start(); |
192 current = this; | 192 current = this; |
193 userTag.makeCurrent(); | 193 userTag.makeCurrent(); |
194 return previous; | 194 return previous; |
195 } | 195 } |
196 | 196 |
197 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()) { | 197 E makeCurrentWhile<E>(E f()) { |
198 PerformanceTag prevTag = makeCurrent(); | 198 PerformanceTag prevTag = makeCurrent(); |
199 try { | 199 try { |
200 return f(); | 200 return f(); |
201 } finally { | 201 } finally { |
202 prevTag.makeCurrent(); | 202 prevTag.makeCurrent(); |
203 } | 203 } |
204 } | 204 } |
205 } | 205 } |
OLD | NEW |