| OLD | NEW |
| 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 | 3 |
| 4 library engine.instrumentation; | 4 library engine.instrumentation; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * The class {@code Instrumentation} implements support for logging instrumentat
ion information. | 9 * The class {@code Instrumentation} implements support for logging instrumentat
ion information. |
| 10 * <p> | 10 * <p> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * 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 | 27 * 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 |
| 28 * arguments and records the time at which the method is called so that the time
to complete the | 28 * arguments and records the time at which the method is called so that the time
to complete the |
| 29 * save operation can be calculated. The {@code log} method tells the builder th
at all of the data | 29 * save operation can be calculated. The {@code log} method tells the builder th
at all of the data |
| 30 * has been collected and that the resulting information should be logged. | 30 * has been collected and that the resulting information should be logged. |
| 31 * @coverage dart.engine.utilities | 31 * @coverage dart.engine.utilities |
| 32 */ | 32 */ |
| 33 class Instrumentation { | 33 class Instrumentation { |
| 34 /** | 34 /** |
| 35 * A builder that will silently ignore all data and logging requests. | 35 * A builder that will silently ignore all data and logging requests. |
| 36 */ | 36 */ |
| 37 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat
ionBuilder_9(); | 37 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat
ionBuilder_13(); |
| 38 /** | 38 /** |
| 39 * An instrumentation logger that can be used when no other instrumentation lo
gger has been | 39 * An instrumentation logger that can be used when no other instrumentation lo
gger has been |
| 40 * configured. This logger will silently ignore all data and logging requests. | 40 * configured. This logger will silently ignore all data and logging requests. |
| 41 */ | 41 */ |
| 42 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_10(); | 42 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_14(); |
| 43 /** | 43 /** |
| 44 * The current instrumentation logger. | 44 * The current instrumentation logger. |
| 45 */ | 45 */ |
| 46 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER; | 46 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER; |
| 47 /** | 47 /** |
| 48 * Create a builder that can collect the data associated with an operation. | 48 * Create a builder that can collect the data associated with an operation. |
| 49 * @param clazz the class performing the operation (not {@code null}) | 49 * @param clazz the class performing the operation (not {@code null}) |
| 50 * @return the builder that was created (not {@code null}) | 50 * @return the builder that was created (not {@code null}) |
| 51 */ | 51 */ |
| 52 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui
lder(clazz.toString()); | 52 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui
lder(clazz.toString()); |
| 53 /** | 53 /** |
| 54 * Create a builder that can collect the data associated with an operation. | 54 * Create a builder that can collect the data associated with an operation. |
| 55 * @param name the name used to uniquely identify the operation (not {@code nu
ll}) | 55 * @param name the name used to uniquely identify the operation (not {@code nu
ll}) |
| 56 * @return the builder that was created (not {@code null}) | 56 * @return the builder that was created (not {@code null}) |
| 57 */ | 57 */ |
| 58 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB
uilder(name); | 58 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB
uilder(name); |
| 59 /** | 59 /** |
| 60 * Get the currently active instrumentation logger |
| 61 */ |
| 62 static InstrumentationLogger get logger => _CURRENT_LOGGER; |
| 63 /** |
| 60 * Return a builder that will silently ignore all data and logging requests. | 64 * Return a builder that will silently ignore all data and logging requests. |
| 61 * @return the builder (not {@code null}) | 65 * @return the builder (not {@code null}) |
| 62 */ | 66 */ |
| 63 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER
; | 67 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER
; |
| 64 /** | 68 /** |
| 69 * Is this instrumentation system currently configured to drop instrumentation
data provided to |
| 70 * it? |
| 71 * @return |
| 72 */ |
| 73 static bool isNullLogger() => identical(_CURRENT_LOGGER, _NULL_LOGGER); |
| 74 /** |
| 65 * Set the logger that should receive instrumentation information to the given
logger. | 75 * Set the logger that should receive instrumentation information to the given
logger. |
| 66 * @param logger the logger that should receive instrumentation information | 76 * @param logger the logger that should receive instrumentation information |
| 67 */ | 77 */ |
| 68 static void set logger(InstrumentationLogger logger3) { | 78 static void set logger(InstrumentationLogger logger3) { |
| 69 _CURRENT_LOGGER = logger3 == null ? _NULL_LOGGER : logger3; | 79 _CURRENT_LOGGER = logger3 == null ? _NULL_LOGGER : logger3; |
| 70 } | 80 } |
| 71 /** | 81 /** |
| 72 * Prevent the creation of instances of this class | 82 * Prevent the creation of instances of this class |
| 73 */ | 83 */ |
| 74 Instrumentation() { | 84 Instrumentation() { |
| 75 } | 85 } |
| 76 } | 86 } |
| 77 class InstrumentationBuilder_9 implements InstrumentationBuilder { | 87 class InstrumentationBuilder_13 implements InstrumentationBuilder { |
| 78 InstrumentationBuilder data(String name, bool value) => this; | 88 InstrumentationBuilder data(String name, bool value) => this; |
| 79 InstrumentationBuilder data2(String name, int value) => this; | 89 InstrumentationBuilder data2(String name, int value) => this; |
| 80 InstrumentationBuilder data3(String name, String value) => this; | 90 InstrumentationBuilder data3(String name, String value) => this; |
| 81 InstrumentationBuilder data4(String name, List<String> value) => this; | 91 InstrumentationBuilder data4(String name, List<String> value) => this; |
| 82 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF; | 92 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF; |
| 83 void log() { | 93 void log() { |
| 84 } | 94 } |
| 85 InstrumentationBuilder metric(String name, bool value) => this; | 95 InstrumentationBuilder metric(String name, bool value) => this; |
| 86 InstrumentationBuilder metric2(String name, int value) => this; | 96 InstrumentationBuilder metric2(String name, int value) => this; |
| 87 InstrumentationBuilder metric3(String name, String value) => this; | 97 InstrumentationBuilder metric3(String name, String value) => this; |
| 88 InstrumentationBuilder metric4(String name, List<String> value) => this; | 98 InstrumentationBuilder metric4(String name, List<String> value) => this; |
| 99 InstrumentationBuilder record(Exception exception) => this; |
| 89 } | 100 } |
| 90 class InstrumentationLogger_10 implements InstrumentationLogger { | 101 class InstrumentationLogger_14 implements InstrumentationLogger { |
| 91 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS
TRUMENTATION_BUILDER; | 102 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS
TRUMENTATION_BUILDER; |
| 92 } | 103 } |
| 93 /** | 104 /** |
| 94 * The interface {@code InstrumentationBuilder} defines the behavior of objects
used to collect data | 105 * The interface {@code InstrumentationBuilder} defines the behavior of objects
used to collect data |
| 95 * about an operation that has occurred and record that data through an instrume
ntation logger. | 106 * about an operation that has occurred and record that data through an instrume
ntation logger. |
| 96 * <p> | 107 * <p> |
| 97 * For an example of using objects that implement this interface, see {@link Ins
trumentation}. | 108 * For an example of using objects that implement this interface, see {@link Ins
trumentation}. |
| 98 * @coverage dart.engine.utilities | 109 * @coverage dart.engine.utilities |
| 99 */ | 110 */ |
| 100 abstract class InstrumentationBuilder { | 111 abstract class InstrumentationBuilder { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 InstrumentationBuilder metric3(String name, String value); | 185 InstrumentationBuilder metric3(String name, String value); |
| 175 /** | 186 /** |
| 176 * Append the given metric to the data being collected by this builder. The in
formation is | 187 * Append the given metric to the data being collected by this builder. The in
formation is |
| 177 * declared to contain only metrics data (data that is not user identifiable a
nd does not contain | 188 * declared to contain only metrics data (data that is not user identifiable a
nd does not contain |
| 178 * user intellectual property). | 189 * user intellectual property). |
| 179 * @param name the name used to identify the data | 190 * @param name the name used to identify the data |
| 180 * @param value the value of the data to be collected | 191 * @param value the value of the data to be collected |
| 181 * @return this builder | 192 * @return this builder |
| 182 */ | 193 */ |
| 183 InstrumentationBuilder metric4(String name, List<String> value); | 194 InstrumentationBuilder metric4(String name, List<String> value); |
| 195 /** |
| 196 * Append the given exception to the information being collected by this build
er. The exception's |
| 197 * class name is captured using {@link #metric(String,String)}. Other aspects
of the exception |
| 198 * may contain either user identifiable or contains user intellectual property
(but is not |
| 199 * guaranteed to contain either) and thus are captured using the various data
methods such as{@link #data(String,String)}. |
| 200 * @param exception the exception (may be {@code null}) |
| 201 */ |
| 202 InstrumentationBuilder record(Exception exception); |
| 184 } | 203 } |
| 185 /** | 204 /** |
| 186 * The instrumentation recording level representing (1) recording {@link #EVERYT
HING} recording of | 205 * The instrumentation recording level representing (1) recording {@link #EVERYT
HING} recording of |
| 187 * all instrumentation data, (2) recording only {@link #METRICS} information, or
(3) recording | 206 * all instrumentation data, (2) recording only {@link #METRICS} information, or
(3) recording |
| 188 * turned {@link #OFF} in which case nothing is recorded. | 207 * turned {@link #OFF} in which case nothing is recorded. |
| 189 * @coverage dart.engine.utilities | 208 * @coverage dart.engine.utilities |
| 190 */ | 209 */ |
| 191 class InstrumentationLevel { | 210 class InstrumentationLevel implements Comparable<InstrumentationLevel> { |
| 192 /** | 211 /** |
| 193 * Recording all instrumented information | 212 * Recording all instrumented information |
| 194 */ | 213 */ |
| 195 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); | 214 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); |
| 196 /** | 215 /** |
| 197 * Recording only metrics | 216 * Recording only metrics |
| 198 */ | 217 */ |
| 199 static final InstrumentationLevel METRICS = new InstrumentationLevel('METRICS'
, 1); | 218 static final InstrumentationLevel METRICS = new InstrumentationLevel('METRICS'
, 1); |
| 200 /** | 219 /** |
| 201 * Nothing recorded | 220 * Nothing recorded |
| (...skipping 10 matching lines...) Expand all Loading... |
| 212 if (str == "METRICS") { | 231 if (str == "METRICS") { |
| 213 return InstrumentationLevel.METRICS; | 232 return InstrumentationLevel.METRICS; |
| 214 } | 233 } |
| 215 if (str == "OFF") { | 234 if (str == "OFF") { |
| 216 return InstrumentationLevel.OFF; | 235 return InstrumentationLevel.OFF; |
| 217 } | 236 } |
| 218 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); | 237 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); |
| 219 } | 238 } |
| 220 InstrumentationLevel(this.__name, this.__ordinal) { | 239 InstrumentationLevel(this.__name, this.__ordinal) { |
| 221 } | 240 } |
| 241 int compareTo(InstrumentationLevel other) => __ordinal - other.__ordinal; |
| 222 String toString() => __name; | 242 String toString() => __name; |
| 223 } | 243 } |
| 224 /** | 244 /** |
| 225 * The interface {@code InstrumentationLogger} defines the behavior of objects t
hat are used to log | 245 * The interface {@code InstrumentationLogger} defines the behavior of objects t
hat are used to log |
| 226 * instrumentation data. | 246 * instrumentation data. |
| 227 * <p> | 247 * <p> |
| 228 * For an example of using objects that implement this interface, see {@link Ins
trumentation}. | 248 * For an example of using objects that implement this interface, see {@link Ins
trumentation}. |
| 229 * @coverage dart.engine.utilities | 249 * @coverage dart.engine.utilities |
| 230 */ | 250 */ |
| 231 abstract class InstrumentationLogger { | 251 abstract class InstrumentationLogger { |
| 232 /** | 252 /** |
| 233 * Create a builder that can collect the data associated with an operation ide
ntified by the given | 253 * Create a builder that can collect the data associated with an operation ide
ntified by the given |
| 234 * name. | 254 * name. |
| 235 * @param name the name used to uniquely identify the operation | 255 * @param name the name used to uniquely identify the operation |
| 236 * @return the builder that was created | 256 * @return the builder that was created |
| 237 */ | 257 */ |
| 238 InstrumentationBuilder createBuilder(String name); | 258 InstrumentationBuilder createBuilder(String name); |
| 239 } | 259 } |
| OLD | NEW |