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

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

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

Powered by Google App Engine
This is Rietveld 408576698