| 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 library engine.instrumentation; | 3 library engine.instrumentation; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 /** | 5 /** |
| 6 * The class {@code Instrumentation} implements support for logging instrumentat
ion information. | 6 * The class `Instrumentation` implements support for logging instrumentation in
formation. |
| 7 * <p> | 7 * |
| 8 * Instrumentation information consists of information about specific operations
. Those operations | 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 | 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{@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[InstrumentationBuilder instrumentation builder], created by one of th
e static methods on |
| 11 * this class such as {@link #builder(Class)} or {@link #builder(String)}. | 11 * this class such as [builder] or [builder]. |
| 12 * <p> | 12 * |
| 13 * 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[setLogger], all instrumentation data will be lost. |
| 14 * <p> | 14 * |
| 15 * <b>Example</b> | 15 * <b>Example</b> |
| 16 * <p> | 16 * |
| 17 * 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 |
| 18 * following: | 18 * following: |
| 19 * <pre> | 19 * <pre> |
| 20 * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClas
s()); | 20 * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClas
s()); |
| 21 * // save the file | 21 * // save the file |
| 22 * instrumentation.metric("chars", fileLength).log(); | 22 * instrumentation.metric("chars", fileLength).log(); |
| 23 * </pre> | 23 * </pre> |
| 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 | 24 * The `Instrumentation.builder` method creates a new [InstrumentationBuilderins
trumentation builder] and records the time at which it was created. The[Instrume
ntationBuilder#metric] appends the information specified by the |
| 25 * 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 |
| 26 * 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 `log` method tells the builder that all
of the data |
| 27 * has been collected and that the resulting information should be logged. | 27 * has been collected and that the resulting information should be logged. |
| 28 * @coverage dart.engine.utilities | 28 * @coverage dart.engine.utilities |
| 29 */ | 29 */ |
| 30 class Instrumentation { | 30 class Instrumentation { |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * A builder that will silently ignore all data and logging requests. | 33 * A builder that will silently ignore all data and logging requests. |
| 34 */ | 34 */ |
| 35 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat
ionBuilder_12(); | 35 static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new Instrumentat
ionBuilder_12(); |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * 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 |
| 39 * configured. This logger will silently ignore all data and logging requests. | 39 * configured. This logger will silently ignore all data and logging requests. |
| 40 */ | 40 */ |
| 41 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_13(); | 41 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_13(); |
| 42 | 42 |
| 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 /** | 48 /** |
| 49 * 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. |
| 50 * @param clazz the class performing the operation (not {@code null}) | 50 * @param clazz the class performing the operation (not `null`) |
| 51 * @return the builder that was created (not {@code null}) | 51 * @return the builder that was created (not `null`) |
| 52 */ | 52 */ |
| 53 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui
lder(clazz.toString()); | 53 static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBui
lder(clazz.toString()); |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * 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. |
| 57 * @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 `null`) |
| 58 * @return the builder that was created (not {@code null}) | 58 * @return the builder that was created (not `null`) |
| 59 */ | 59 */ |
| 60 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB
uilder(name); | 60 static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createB
uilder(name); |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Get the currently active instrumentation logger | 63 * Get the currently active instrumentation logger |
| 64 */ | 64 */ |
| 65 static InstrumentationLogger get logger => _CURRENT_LOGGER; | 65 static InstrumentationLogger get logger => _CURRENT_LOGGER; |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * 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. |
| 69 * @return the builder (not {@code null}) | 69 * @return the builder (not `null`) |
| 70 */ | 70 */ |
| 71 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER
; | 71 static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER
; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * 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 |
| 75 * it? | 75 * it? |
| 76 * @return | 76 * @return |
| 77 */ | 77 */ |
| 78 static bool isNullLogger() => identical(_CURRENT_LOGGER, _NULL_LOGGER); | 78 static bool isNullLogger() => identical(_CURRENT_LOGGER, _NULL_LOGGER); |
| 79 | 79 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 InstrumentationBuilder metric(String name, bool value) => this; | 96 InstrumentationBuilder metric(String name, bool value) => this; |
| 97 InstrumentationBuilder metric2(String name, int value) => this; | 97 InstrumentationBuilder metric2(String name, int value) => this; |
| 98 InstrumentationBuilder metric3(String name, String value) => this; | 98 InstrumentationBuilder metric3(String name, String value) => this; |
| 99 InstrumentationBuilder metric4(String name, List<String> value) => this; | 99 InstrumentationBuilder metric4(String name, List<String> value) => this; |
| 100 InstrumentationBuilder record(Exception exception) => this; | 100 InstrumentationBuilder record(Exception exception) => this; |
| 101 } | 101 } |
| 102 class InstrumentationLogger_13 implements InstrumentationLogger { | 102 class InstrumentationLogger_13 implements InstrumentationLogger { |
| 103 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS
TRUMENTATION_BUILDER; | 103 InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INS
TRUMENTATION_BUILDER; |
| 104 } | 104 } |
| 105 /** | 105 /** |
| 106 * The interface {@code InstrumentationBuilder} defines the behavior of objects
used to collect data | 106 * The interface `InstrumentationBuilder` defines the behavior of objects used t
o collect data |
| 107 * 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. |
| 108 * <p> | 108 * |
| 109 * 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 [Instrumen
tation]. |
| 110 * @coverage dart.engine.utilities | 110 * @coverage dart.engine.utilities |
| 111 */ | 111 */ |
| 112 abstract class InstrumentationBuilder { | 112 abstract class InstrumentationBuilder { |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * 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 |
| 116 * 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 |
| 117 * property (but is not guaranteed to contain either). | 117 * property (but is not guaranteed to contain either). |
| 118 * @param name the name used to identify the data | 118 * @param name the name used to identify the data |
| 119 * @param value the value of the data to be collected | 119 * @param value the value of the data to be collected |
| (...skipping 25 matching lines...) Expand all Loading... |
| 145 * 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 |
| 146 * 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 |
| 147 * property (but is not guaranteed to contain either). | 147 * property (but is not guaranteed to contain either). |
| 148 * @param name the name used to identify the data | 148 * @param name the name used to identify the data |
| 149 * @param value the value of the data to be collected | 149 * @param value the value of the data to be collected |
| 150 * @return this builder | 150 * @return this builder |
| 151 */ | 151 */ |
| 152 InstrumentationBuilder data4(String name, List<String> value); | 152 InstrumentationBuilder data4(String name, List<String> value); |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * Answer the {@link InstrumentationLevel} of this {@code InstrumentationBuild
er}. | 155 * Answer the [InstrumentationLevel] of this `InstrumentationBuilder`. |
| 156 * @return one of {@link InstrumentationLevel#EVERYTHING}, {@link Instrumentat
ionLevel#METRICS},{@link InstrumentationLevel#OFF} | 156 * @return one of [InstrumentationLevel#EVERYTHING], [InstrumentationLevel#MET
RICS],[InstrumentationLevel#OFF] |
| 157 */ | 157 */ |
| 158 InstrumentationLevel get instrumentationLevel; | 158 InstrumentationLevel get instrumentationLevel; |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * 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 |
| 162 * 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 |
| 163 * method is invoked is undefined. | 163 * method is invoked is undefined. |
| 164 */ | 164 */ |
| 165 void log(); | 165 void log(); |
| 166 | 166 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 * 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 |
| 200 * user intellectual property). | 200 * user intellectual property). |
| 201 * @param name the name used to identify the data | 201 * @param name the name used to identify the data |
| 202 * @param value the value of the data to be collected | 202 * @param value the value of the data to be collected |
| 203 * @return this builder | 203 * @return this builder |
| 204 */ | 204 */ |
| 205 InstrumentationBuilder metric4(String name, List<String> value); | 205 InstrumentationBuilder metric4(String name, List<String> value); |
| 206 | 206 |
| 207 /** | 207 /** |
| 208 * 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 |
| 209 * class name is captured using {@link #metric(String,String)}. Other aspects
of the exception | 209 * class name is captured using [metric]. Other aspects of the exception |
| 210 * 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 |
| 211 * 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[data]. |
| 212 * @param exception the exception (may be {@code null}) | 212 * @param exception the exception (may be `null`) |
| 213 */ | 213 */ |
| 214 InstrumentationBuilder record(Exception exception); | 214 InstrumentationBuilder record(Exception exception); |
| 215 } | 215 } |
| 216 /** | 216 /** |
| 217 * The instrumentation recording level representing (1) recording {@link #EVERYT
HING} recording of | 217 * The instrumentation recording level representing (1) recording [EVERYTHING] r
ecording of |
| 218 * all instrumentation data, (2) recording only {@link #METRICS} information, or
(3) recording | 218 * all instrumentation data, (2) recording only [METRICS] information, or (3) re
cording |
| 219 * turned {@link #OFF} in which case nothing is recorded. | 219 * turned [OFF] in which case nothing is recorded. |
| 220 * @coverage dart.engine.utilities | 220 * @coverage dart.engine.utilities |
| 221 */ | 221 */ |
| 222 class InstrumentationLevel implements Comparable<InstrumentationLevel> { | 222 class InstrumentationLevel implements Comparable<InstrumentationLevel> { |
| 223 | 223 |
| 224 /** | 224 /** |
| 225 * Recording all instrumented information | 225 * Recording all instrumented information |
| 226 */ | 226 */ |
| 227 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); | 227 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); |
| 228 | 228 |
| 229 /** | 229 /** |
| (...skipping 24 matching lines...) Expand all Loading... |
| 254 } | 254 } |
| 255 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); | 255 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); |
| 256 } | 256 } |
| 257 InstrumentationLevel(this.name, this.ordinal) { | 257 InstrumentationLevel(this.name, this.ordinal) { |
| 258 } | 258 } |
| 259 int compareTo(InstrumentationLevel other) => ordinal - other.ordinal; | 259 int compareTo(InstrumentationLevel other) => ordinal - other.ordinal; |
| 260 int get hashCode => ordinal; | 260 int get hashCode => ordinal; |
| 261 String toString() => name; | 261 String toString() => name; |
| 262 } | 262 } |
| 263 /** | 263 /** |
| 264 * The interface {@code InstrumentationLogger} defines the behavior of objects t
hat are used to log | 264 * The interface `InstrumentationLogger` defines the behavior of objects that ar
e used to log |
| 265 * instrumentation data. | 265 * instrumentation data. |
| 266 * <p> | 266 * |
| 267 * For an example of using objects that implement this interface, see {@link Ins
trumentation}. | 267 * For an example of using objects that implement this interface, see [Instrumen
tation]. |
| 268 * @coverage dart.engine.utilities | 268 * @coverage dart.engine.utilities |
| 269 */ | 269 */ |
| 270 abstract class InstrumentationLogger { | 270 abstract class InstrumentationLogger { |
| 271 | 271 |
| 272 /** | 272 /** |
| 273 * Create a builder that can collect the data associated with an operation ide
ntified by the given | 273 * Create a builder that can collect the data associated with an operation ide
ntified by the given |
| 274 * name. | 274 * name. |
| 275 * @param name the name used to uniquely identify the operation | 275 * @param name the name used to uniquely identify the operation |
| 276 * @return the builder that was created | 276 * @return the builder that was created |
| 277 */ | 277 */ |
| 278 InstrumentationBuilder createBuilder(String name); | 278 InstrumentationBuilder createBuilder(String name); |
| 279 } | 279 } |
| OLD | NEW |