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

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

Issue 45573002: Rename analyzer_experimental to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks before publishing. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information.
3 library engine.instrumentation;
4 import 'java_core.dart';
5 /**
6 * The class `Instrumentation` implements support for logging instrumentation in formation.
7 *
8 * Instrumentation information consists of information about specific operations . Those operations
9 * can range from user-facing operations, such as saving the changes to a file, to internal
10 * operations, such as tokenizing source code. The information to be logged is g athered by
11 * [InstrumentationBuilder], created by one of the static methods on
12 * this class such as [builder] or [builder].
13 *
14 * Note, however, that until an instrumentation logger is installed using the me thod
15 * [setLogger], all instrumentation data will be lost.
16 *
17 * <b>Example</b>
18 *
19 * To collect metrics about how long it took to save a file, you would write som ething like the
20 * following:
21 *
22 * <pre>
23 * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClas s());
24 * // save the file
25 * instrumentation.metric("chars", fileLength).log();
26 * </pre>
27 * The `Instrumentation.builder` method creates a new [InstrumentationBuilder
28 ] and records the time at which it was created. The
29 * [InstrumentationBuilder#metric] appends the information specified by the
30 * arguments and records the time at which the method is called so that the time to complete the
31 * save operation can be calculated. The `log` method tells the builder that all of the data
32 * has been collected and that the resulting information should be logged.
33 *
34 * @coverage dart.engine.utilities
35 */
36 class Instrumentation {
37
38 /**
39 * A builder that will silently ignore all data and logging requests.
40 */
41 static final InstrumentationBuilder nullBuilder = new InstrumentationBuilder_1 6();
42
43 /**
44 * An instrumentation logger that can be used when no other instrumentation lo gger has been
45 * configured. This logger will silently ignore all data and logging requests.
46 */
47 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_17();
48
49 /**
50 * The current instrumentation logger.
51 */
52 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER;
53
54 /**
55 * Create a builder that can collect the data associated with an operation.
56 *
57 * @param clazz the class performing the operation (not `null`)
58 * @return the builder that was created (not `null`)
59 */
60 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui lder(clazz.toString());
61
62 /**
63 * Create a builder that can collect the data associated with an operation.
64 *
65 * @param name the name used to uniquely identify the operation (not `null`)
66 * @return the builder that was created (not `null`)
67 */
68 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB uilder(name);
69
70 /**
71 * Get the currently active instrumentation logger
72 */
73 static InstrumentationLogger get logger => _CURRENT_LOGGER;
74
75 /**
76 * Is this instrumentation system currently configured to drop instrumentation data provided to
77 * it?
78 *
79 * @return
80 */
81 static bool get isNullLogger => identical(_CURRENT_LOGGER, _NULL_LOGGER);
82
83 /**
84 * Set the logger that should receive instrumentation information to the given logger.
85 *
86 * @param logger the logger that should receive instrumentation information
87 */
88 static void set logger(InstrumentationLogger logger) {
89 _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger;
90 }
91 }
92 class InstrumentationBuilder_16 implements InstrumentationBuilder {
93 InstrumentationBuilder data(String name, bool value) => this;
94 InstrumentationBuilder data2(String name, int value) => this;
95 InstrumentationBuilder data3(String name, String value) => this;
96 InstrumentationBuilder data4(String name, List<String> value) => this;
97 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF;
98 void log() {
99 }
100 void log2(int minTimeToLong) {
101 }
102 InstrumentationBuilder metric(String name, bool value) => this;
103 InstrumentationBuilder metric2(String name, int value) => this;
104 InstrumentationBuilder metric3(String name, String value) => this;
105 InstrumentationBuilder metric4(String name, List<String> value) => this;
106 InstrumentationBuilder record(Exception exception) => this;
107 }
108 class InstrumentationLogger_17 implements InstrumentationLogger {
109 InstrumentationBuilder createBuilder(String name) => Instrumentation.nullBuild er;
110 }
111 /**
112 * The interface `InstrumentationBuilder` defines the behavior of objects used t o collect data
113 * about an operation that has occurred and record that data through an instrume ntation logger.
114 *
115 * For an example of using objects that implement this interface, see [Instrumen tation].
116 *
117 * @coverage dart.engine.utilities
118 */
119 abstract class InstrumentationBuilder {
120
121 /**
122 * Append the given data to the data being collected by this builder. The info rmation is declared
123 * to potentially contain data that is either user identifiable or contains us er intellectual
124 * property (but is not guaranteed to contain either).
125 *
126 * @param name the name used to identify the data
127 * @param value the value of the data to be collected
128 * @return this builder
129 */
130 InstrumentationBuilder data(String name, bool value);
131
132 /**
133 * Append the given data to the data being collected by this builder. The info rmation is declared
134 * to potentially contain data that is either user identifiable or contains us er intellectual
135 * property (but is not guaranteed to contain either).
136 *
137 * @param name the name used to identify the data
138 * @param value the value of the data to be collected
139 * @return this builder
140 */
141 InstrumentationBuilder data2(String name, int value);
142
143 /**
144 * Append the given data to the data being collected by this builder. The info rmation is declared
145 * to potentially contain data that is either user identifiable or contains us er intellectual
146 * property (but is not guaranteed to contain either).
147 *
148 * @param name the name used to identify the data
149 * @param value the value of the data to be collected
150 * @return this builder
151 */
152 InstrumentationBuilder data3(String name, String value);
153
154 /**
155 * Append the given data to the data being collected by this builder. The info rmation is declared
156 * to potentially contain data that is either user identifiable or contains us er intellectual
157 * property (but is not guaranteed to contain either).
158 *
159 * @param name the name used to identify the data
160 * @param value the value of the data to be collected
161 * @return this builder
162 */
163 InstrumentationBuilder data4(String name, List<String> value);
164
165 /**
166 * Answer the [InstrumentationLevel] of this `InstrumentationBuilder`.
167 *
168 * @return one of [InstrumentationLevel#EVERYTHING], [InstrumentationLevel#MET RICS],
169 * [InstrumentationLevel#OFF]
170 */
171 InstrumentationLevel get instrumentationLevel;
172
173 /**
174 * Log the data that has been collected. The instrumentation builder should no t be used after this
175 * method is invoked. The behavior of any method defined on this interface tha t is used after this
176 * method is invoked is undefined.
177 */
178 void log();
179
180 /**
181 * Log the data that has been collected. The instrumentation builder should no t be used after this
182 * method is invoked. The behavior of any method defined on this interface tha t is used after this
183 * method is invoked is undefined.
184 *
185 * @param minTimeToLog if the total elapsed time is less than this, do not rec ord
186 */
187 void log2(int minTimeToLog);
188
189 /**
190 * Append the given metric to the data being collected by this builder. The in formation is
191 * declared to contain only metrics data (data that is not user identifiable a nd does not contain
192 * user intellectual property).
193 *
194 * @param name the name used to identify the data
195 * @param value the value of the data to be collected
196 * @return this builder
197 */
198 InstrumentationBuilder metric(String name, bool value);
199
200 /**
201 * Append the given metric to the data being collected by this builder. The in formation is
202 * declared to contain only metrics data (data that is not user identifiable a nd does not contain
203 * user intellectual property).
204 *
205 * @param name the name used to identify the data
206 * @param value the value of the data to be collected
207 * @return this builder
208 */
209 InstrumentationBuilder metric2(String name, int value);
210
211 /**
212 * Append the given metric to the data being collected by this builder. The in formation is
213 * declared to contain only metrics data (data that is not user identifiable a nd does not contain
214 * user intellectual property).
215 *
216 * @param name the name used to identify the data
217 * @param value the value of the data to be collected
218 * @return this builder
219 */
220 InstrumentationBuilder metric3(String name, String value);
221
222 /**
223 * Append the given metric to the data being collected by this builder. The in formation is
224 * declared to contain only metrics data (data that is not user identifiable a nd does not contain
225 * user intellectual property).
226 *
227 * @param name the name used to identify the data
228 * @param value the value of the data to be collected
229 * @return this builder
230 */
231 InstrumentationBuilder metric4(String name, List<String> value);
232
233 /**
234 * Append the given exception to the information being collected by this build er. The exception's
235 * class name is captured using [metric]. Other aspects of the exception
236 * may contain either user identifiable or contains user intellectual property (but is not
237 * guaranteed to contain either) and thus are captured using the various data methods such as
238 * [data].
239 *
240 * @param exception the exception (may be `null`)
241 */
242 InstrumentationBuilder record(Exception exception);
243 }
244 /**
245 * The instrumentation recording level representing (1) recording [EVERYTHING] r ecording of
246 * all instrumentation data, (2) recording only [METRICS] information, or (3) re cording
247 * turned [OFF] in which case nothing is recorded.
248 *
249 * @coverage dart.engine.utilities
250 */
251 class InstrumentationLevel extends Enum<InstrumentationLevel> {
252
253 /** Recording all instrumented information */
254 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY THING', 0);
255
256 /** Recording only metrics */
257 static final InstrumentationLevel METRICS = new InstrumentationLevel('METRICS' , 1);
258
259 /** Nothing recorded */
260 static final InstrumentationLevel OFF = new InstrumentationLevel('OFF', 2);
261 static final List<InstrumentationLevel> values = [EVERYTHING, METRICS, OFF];
262 static InstrumentationLevel fromString(String str) {
263 if (str == "EVERYTHING") {
264 return InstrumentationLevel.EVERYTHING;
265 }
266 if (str == "METRICS") {
267 return InstrumentationLevel.METRICS;
268 }
269 if (str == "OFF") {
270 return InstrumentationLevel.OFF;
271 }
272 throw new IllegalArgumentException("Unrecognised InstrumentationLevel");
273 }
274 InstrumentationLevel(String name, int ordinal) : super(name, ordinal);
275 }
276 /**
277 * The interface `InstrumentationLogger` defines the behavior of objects that ar e used to log
278 * instrumentation data.
279 *
280 * For an example of using objects that implement this interface, see [Instrumen tation].
281 *
282 * @coverage dart.engine.utilities
283 */
284 abstract class InstrumentationLogger {
285
286 /**
287 * Create a builder that can collect the data associated with an operation ide ntified by the given
288 * name.
289 *
290 * @param name the name used to uniquely identify the operation
291 * @return the builder that was created
292 */
293 InstrumentationBuilder createBuilder(String name);
294 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/html.dart ('k') | pkg/analyzer_experimental/lib/src/generated/java_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698