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

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

Issue 257773008: New analyzer snapshot, based on r35422. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update pubspec.yaml Created 6 years, 8 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.instrumentation; 8 library engine.instrumentation;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
11 11
12 /** 12 /**
13 * The class `Instrumentation` implements support for logging instrumentation in formation. 13 * The interface `InstrumentationLogger` defines the behavior of objects that ar e used to log
14 * instrumentation data.
14 * 15 *
15 * Instrumentation information consists of information about specific operations . Those operations 16 * For an example of using objects that implement this interface, see [Instrumen tation].
16 * can range from user-facing operations, such as saving the changes to a file, to internal
17 * operations, such as tokenizing source code. The information to be logged is g athered by
18 * [InstrumentationBuilder], created by one of the static methods on
19 * this class such as [builder] or [builder].
20 *
21 * Note, however, that until an instrumentation logger is installed using the me thod
22 * [setLogger], all instrumentation data will be lost.
23 *
24 * <b>Example</b>
25 *
26 * To collect metrics about how long it took to save a file, you would write som ething like the
27 * following:
28 *
29 * <pre>
30 * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClas s());
31 * // save the file
32 * instrumentation.metric("chars", fileLength).log();
33 * </pre>
34 * The `Instrumentation.builder` method creates a new [InstrumentationBuilder
35 ] and records the time at which it was created. The
36 * [InstrumentationBuilder#metric] appends the information specified by the
37 * arguments and records the time at which the method is called so that the time to complete the
38 * save operation can be calculated. The `log` method tells the builder that all of the data
39 * has been collected and that the resulting information should be logged.
40 */ 17 */
41 class Instrumentation { 18 abstract class InstrumentationLogger {
42 /** 19 /**
43 * A builder that will silently ignore all data and logging requests. 20 * Create a builder that can collect the data associated with an operation ide ntified by the given
21 * name.
22 *
23 * @param name the name used to uniquely identify the operation
24 * @return the builder that was created
44 */ 25 */
45 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat ionBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER(); 26 InstrumentationBuilder createBuilder(String name);
46
47 /**
48 * An instrumentation logger that can be used when no other instrumentation lo gger has been
49 * configured. This logger will silently ignore all data and logging requests.
50 */
51 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_Instrume ntation_NULL_LOGGER();
52
53 /**
54 * The current instrumentation logger.
55 */
56 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER;
57
58 /**
59 * Create a builder that can collect the data associated with an operation.
60 *
61 * @param clazz the class performing the operation (not `null`)
62 * @return the builder that was created (not `null`)
63 */
64 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui lder(clazz.toString());
65
66 /**
67 * Create a builder that can collect the data associated with an operation.
68 *
69 * @param name the name used to uniquely identify the operation (not `null`)
70 * @return the builder that was created (not `null`)
71 */
72 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB uilder(name);
73
74 /**
75 * Get the currently active instrumentation logger
76 */
77 static InstrumentationLogger get logger => _CURRENT_LOGGER;
78
79 /**
80 * Return a builder that will silently ignore all data and logging requests.
81 *
82 * @return the builder (not `null`)
83 */
84 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER ;
85
86 /**
87 * Is this instrumentation system currently configured to drop instrumentation data provided to
88 * it?
89 *
90 * @return
91 */
92 static bool get isNullLogger => identical(_CURRENT_LOGGER, _NULL_LOGGER);
93
94 /**
95 * Set the logger that should receive instrumentation information to the given logger.
96 *
97 * @param logger the logger that should receive instrumentation information
98 */
99 static void set logger(InstrumentationLogger logger) {
100 _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger;
101 }
102 }
103
104 class InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER implem ents InstrumentationBuilder {
105 @override
106 InstrumentationBuilder data(String name, bool value) => this;
107
108 @override
109 InstrumentationBuilder data2(String name, int value) => this;
110
111 @override
112 InstrumentationBuilder data3(String name, String value) => this;
113
114 @override
115 InstrumentationBuilder data4(String name, List<String> value) => this;
116
117 @override
118 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF;
119
120 @override
121 void log() {
122 }
123
124 @override
125 void log2(int minTimeToLong) {
126 }
127
128 @override
129 InstrumentationBuilder metric(String name, bool value) => this;
130
131 @override
132 InstrumentationBuilder metric2(String name, int value) => this;
133
134 @override
135 InstrumentationBuilder metric3(String name, String value) => this;
136
137 @override
138 InstrumentationBuilder metric4(String name, List<String> value) => this;
139
140 @override
141 InstrumentationBuilder record(Exception exception) => this;
142 }
143
144 class InstrumentationLogger_Instrumentation_NULL_LOGGER implements Instrumentati onLogger {
145 @override
146 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS TRUMENTATION_BUILDER;
147 } 27 }
148 28
149 /** 29 /**
30 * The instrumentation recording level representing (1) recording [EVERYTHING] r ecording of
31 * all instrumentation data, (2) recording only [METRICS] information, or (3) re cording
32 * turned [OFF] in which case nothing is recorded.
33 */
34 class InstrumentationLevel extends Enum<InstrumentationLevel> {
35 /** Recording all instrumented information */
36 static const InstrumentationLevel EVERYTHING = const InstrumentationLevel('EVE RYTHING', 0);
37
38 /** Recording only metrics */
39 static const InstrumentationLevel METRICS = const InstrumentationLevel('METRIC S', 1);
40
41 /** Nothing recorded */
42 static const InstrumentationLevel OFF = const InstrumentationLevel('OFF', 2);
43
44 static const List<InstrumentationLevel> values = const [EVERYTHING, METRICS, O FF];
45
46 static InstrumentationLevel fromString(String str) {
47 if (str == "EVERYTHING") {
48 return InstrumentationLevel.EVERYTHING;
49 }
50 if (str == "METRICS") {
51 return InstrumentationLevel.METRICS;
52 }
53 if (str == "OFF") {
54 return InstrumentationLevel.OFF;
55 }
56 throw new IllegalArgumentException("Unrecognised InstrumentationLevel");
57 }
58
59 const InstrumentationLevel(String name, int ordinal) : super(name, ordinal);
60 }
61
62 /**
150 * The interface `InstrumentationBuilder` defines the behavior of objects used t o collect data 63 * The interface `InstrumentationBuilder` defines the behavior of objects used t o collect data
151 * about an operation that has occurred and record that data through an instrume ntation logger. 64 * about an operation that has occurred and record that data through an instrume ntation logger.
152 * 65 *
153 * For an example of using objects that implement this interface, see [Instrumen tation]. 66 * For an example of using objects that implement this interface, see [Instrumen tation].
154 */ 67 */
155 abstract class InstrumentationBuilder { 68 abstract class InstrumentationBuilder {
156 /** 69 /**
157 * Append the given data to the data being collected by this builder. The info rmation is declared 70 * Append the given data to the data being collected by this builder. The info rmation is declared
158 * to potentially contain data that is either user identifiable or contains us er intellectual 71 * to potentially contain data that is either user identifiable or contains us er intellectual
159 * property (but is not guaranteed to contain either). 72 * property (but is not guaranteed to contain either).
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 * may contain either user identifiable or contains user intellectual property (but is not 184 * may contain either user identifiable or contains user intellectual property (but is not
272 * guaranteed to contain either) and thus are captured using the various data methods such as 185 * guaranteed to contain either) and thus are captured using the various data methods such as
273 * [data]. 186 * [data].
274 * 187 *
275 * @param exception the exception (may be `null`) 188 * @param exception the exception (may be `null`)
276 */ 189 */
277 InstrumentationBuilder record(Exception exception); 190 InstrumentationBuilder record(Exception exception);
278 } 191 }
279 192
280 /** 193 /**
281 * The instrumentation recording level representing (1) recording [EVERYTHING] r ecording of 194 * The class `Instrumentation` implements support for logging instrumentation in formation.
282 * all instrumentation data, (2) recording only [METRICS] information, or (3) re cording 195 *
283 * turned [OFF] in which case nothing is recorded. 196 * Instrumentation information consists of information about specific operations . Those operations
197 * can range from user-facing operations, such as saving the changes to a file, to internal
198 * operations, such as tokenizing source code. The information to be logged is g athered by
199 * [InstrumentationBuilder], created by one of the static methods on
200 * this class such as [builder] or [builder].
201 *
202 * Note, however, that until an instrumentation logger is installed using the me thod
203 * [setLogger], all instrumentation data will be lost.
204 *
205 * <b>Example</b>
206 *
207 * To collect metrics about how long it took to save a file, you would write som ething like the
208 * following:
209 *
210 * <pre>
211 * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClas s());
212 * // save the file
213 * instrumentation.metric("chars", fileLength).log();
214 * </pre>
215 * The `Instrumentation.builder` method creates a new [InstrumentationBuilder
216 ] and records the time at which it was created. The
217 * [InstrumentationBuilder#metric] appends the information specified by the
218 * arguments and records the time at which the method is called so that the time to complete the
219 * save operation can be calculated. The `log` method tells the builder that all of the data
220 * has been collected and that the resulting information should be logged.
284 */ 221 */
285 class InstrumentationLevel extends Enum<InstrumentationLevel> { 222 class Instrumentation {
286 /** Recording all instrumented information */ 223 /**
287 static const InstrumentationLevel EVERYTHING = const InstrumentationLevel('EVE RYTHING', 0); 224 * A builder that will silently ignore all data and logging requests.
225 */
226 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat ionBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER();
288 227
289 /** Recording only metrics */ 228 /**
290 static const InstrumentationLevel METRICS = const InstrumentationLevel('METRIC S', 1); 229 * An instrumentation logger that can be used when no other instrumentation lo gger has been
230 * configured. This logger will silently ignore all data and logging requests.
231 */
232 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_Instrume ntation_NULL_LOGGER();
291 233
292 /** Nothing recorded */ 234 /**
293 static const InstrumentationLevel OFF = const InstrumentationLevel('OFF', 2); 235 * The current instrumentation logger.
236 */
237 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER;
294 238
295 static const List<InstrumentationLevel> values = const [EVERYTHING, METRICS, O FF]; 239 /**
240 * Create a builder that can collect the data associated with an operation.
241 *
242 * @param clazz the class performing the operation (not `null`)
243 * @return the builder that was created (not `null`)
244 */
245 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui lder(clazz.toString());
296 246
297 static InstrumentationLevel fromString(String str) { 247 /**
298 if (str == "EVERYTHING") { 248 * Create a builder that can collect the data associated with an operation.
299 return InstrumentationLevel.EVERYTHING; 249 *
300 } 250 * @param name the name used to uniquely identify the operation (not `null`)
301 if (str == "METRICS") { 251 * @return the builder that was created (not `null`)
302 return InstrumentationLevel.METRICS; 252 */
303 } 253 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB uilder(name);
304 if (str == "OFF") { 254
305 return InstrumentationLevel.OFF; 255 /**
306 } 256 * Get the currently active instrumentation logger
307 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); 257 */
258 static InstrumentationLogger get logger => _CURRENT_LOGGER;
259
260 /**
261 * Return a builder that will silently ignore all data and logging requests.
262 *
263 * @return the builder (not `null`)
264 */
265 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER ;
266
267 /**
268 * Is this instrumentation system currently configured to drop instrumentation data provided to
269 * it?
270 *
271 * @return
272 */
273 static bool get isNullLogger => identical(_CURRENT_LOGGER, _NULL_LOGGER);
274
275 /**
276 * Set the logger that should receive instrumentation information to the given logger.
277 *
278 * @param logger the logger that should receive instrumentation information
279 */
280 static void set logger(InstrumentationLogger logger) {
281 _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger;
282 }
283 }
284
285 class InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER implem ents InstrumentationBuilder {
286 @override
287 InstrumentationBuilder data(String name, bool value) => this;
288
289 @override
290 InstrumentationBuilder data2(String name, int value) => this;
291
292 @override
293 InstrumentationBuilder data3(String name, String value) => this;
294
295 @override
296 InstrumentationBuilder data4(String name, List<String> value) => this;
297
298 @override
299 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF;
300
301 @override
302 void log() {
308 } 303 }
309 304
310 const InstrumentationLevel(String name, int ordinal) : super(name, ordinal); 305 @override
306 void log2(int minTimeToLong) {
307 }
308
309 @override
310 InstrumentationBuilder metric(String name, bool value) => this;
311
312 @override
313 InstrumentationBuilder metric2(String name, int value) => this;
314
315 @override
316 InstrumentationBuilder metric3(String name, String value) => this;
317
318 @override
319 InstrumentationBuilder metric4(String name, List<String> value) => this;
320
321 @override
322 InstrumentationBuilder record(Exception exception) => this;
311 } 323 }
312 324
313 /** 325 class InstrumentationLogger_Instrumentation_NULL_LOGGER implements Instrumentati onLogger {
314 * The interface `InstrumentationLogger` defines the behavior of objects that ar e used to log 326 @override
315 * instrumentation data. 327 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS TRUMENTATION_BUILDER;
316 *
317 * For an example of using objects that implement this interface, see [Instrumen tation].
318 */
319 abstract class InstrumentationLogger {
320 /**
321 * Create a builder that can collect the data associated with an operation ide ntified by the given
322 * name.
323 *
324 * @param name the name used to uniquely identify the operation
325 * @return the builder that was created
326 */
327 InstrumentationBuilder createBuilder(String name);
328 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698