| 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 library engine.instrumentation; | 4 library engine.instrumentation; |
| 5 |
| 4 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 |
| 5 /** | 8 /** |
| 6 * The class `Instrumentation` implements support for logging instrumentation in
formation. | 9 * The class `Instrumentation` implements support for logging instrumentation in
formation. |
| 7 * | 10 * |
| 8 * Instrumentation information consists of information about specific operations
. Those operations | 11 * 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 | 12 * 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 | 13 * 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 | 14 * [InstrumentationBuilder], created by one of the static methods on |
| 12 * this class such as [builder] or [builder]. | 15 * this class such as [builder] or [builder]. |
| 13 * | 16 * |
| 14 * Note, however, that until an instrumentation logger is installed using the me
thod | 17 * Note, however, that until an instrumentation logger is installed using the me
thod |
| (...skipping 12 matching lines...) Expand all Loading... |
| 27 * The `Instrumentation.builder` method creates a new [InstrumentationBuilder | 30 * The `Instrumentation.builder` method creates a new [InstrumentationBuilder |
| 28 ] and records the time at which it was created. The | 31 ] and records the time at which it was created. The |
| 29 * [InstrumentationBuilder#metric] appends the information specified by the | 32 * [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 | 33 * 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 | 34 * 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. | 35 * has been collected and that the resulting information should be logged. |
| 33 * | 36 * |
| 34 * @coverage dart.engine.utilities | 37 * @coverage dart.engine.utilities |
| 35 */ | 38 */ |
| 36 class Instrumentation { | 39 class Instrumentation { |
| 37 | |
| 38 /** | 40 /** |
| 39 * A builder that will silently ignore all data and logging requests. | 41 * A builder that will silently ignore all data and logging requests. |
| 40 */ | 42 */ |
| 41 static final InstrumentationBuilder nullBuilder = new InstrumentationBuilder_1
6(); | 43 static final InstrumentationBuilder nullBuilder = new InstrumentationBuilder_1
7(); |
| 42 | 44 |
| 43 /** | 45 /** |
| 44 * An instrumentation logger that can be used when no other instrumentation lo
gger has been | 46 * 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. | 47 * configured. This logger will silently ignore all data and logging requests. |
| 46 */ | 48 */ |
| 47 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_17(); | 49 static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_18(); |
| 48 | 50 |
| 49 /** | 51 /** |
| 50 * The current instrumentation logger. | 52 * The current instrumentation logger. |
| 51 */ | 53 */ |
| 52 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER; | 54 static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER; |
| 53 | 55 |
| 54 /** | 56 /** |
| 55 * Create a builder that can collect the data associated with an operation. | 57 * Create a builder that can collect the data associated with an operation. |
| 56 * | 58 * |
| 57 * @param clazz the class performing the operation (not `null`) | 59 * @param clazz the class performing the operation (not `null`) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 82 | 84 |
| 83 /** | 85 /** |
| 84 * Set the logger that should receive instrumentation information to the given
logger. | 86 * Set the logger that should receive instrumentation information to the given
logger. |
| 85 * | 87 * |
| 86 * @param logger the logger that should receive instrumentation information | 88 * @param logger the logger that should receive instrumentation information |
| 87 */ | 89 */ |
| 88 static void set logger(InstrumentationLogger logger) { | 90 static void set logger(InstrumentationLogger logger) { |
| 89 _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger; | 91 _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger; |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 class InstrumentationBuilder_16 implements InstrumentationBuilder { | 94 |
| 95 class InstrumentationBuilder_17 implements InstrumentationBuilder { |
| 93 InstrumentationBuilder data(String name, bool value) => this; | 96 InstrumentationBuilder data(String name, bool value) => this; |
| 97 |
| 94 InstrumentationBuilder data2(String name, int value) => this; | 98 InstrumentationBuilder data2(String name, int value) => this; |
| 99 |
| 95 InstrumentationBuilder data3(String name, String value) => this; | 100 InstrumentationBuilder data3(String name, String value) => this; |
| 101 |
| 96 InstrumentationBuilder data4(String name, List<String> value) => this; | 102 InstrumentationBuilder data4(String name, List<String> value) => this; |
| 103 |
| 97 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF; | 104 InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF; |
| 105 |
| 98 void log() { | 106 void log() { |
| 99 } | 107 } |
| 108 |
| 100 void log2(int minTimeToLong) { | 109 void log2(int minTimeToLong) { |
| 101 } | 110 } |
| 111 |
| 102 InstrumentationBuilder metric(String name, bool value) => this; | 112 InstrumentationBuilder metric(String name, bool value) => this; |
| 113 |
| 103 InstrumentationBuilder metric2(String name, int value) => this; | 114 InstrumentationBuilder metric2(String name, int value) => this; |
| 115 |
| 104 InstrumentationBuilder metric3(String name, String value) => this; | 116 InstrumentationBuilder metric3(String name, String value) => this; |
| 117 |
| 105 InstrumentationBuilder metric4(String name, List<String> value) => this; | 118 InstrumentationBuilder metric4(String name, List<String> value) => this; |
| 119 |
| 106 InstrumentationBuilder record(Exception exception) => this; | 120 InstrumentationBuilder record(Exception exception) => this; |
| 107 } | 121 } |
| 108 class InstrumentationLogger_17 implements InstrumentationLogger { | 122 |
| 123 class InstrumentationLogger_18 implements InstrumentationLogger { |
| 109 InstrumentationBuilder createBuilder(String name) => Instrumentation.nullBuild
er; | 124 InstrumentationBuilder createBuilder(String name) => Instrumentation.nullBuild
er; |
| 110 } | 125 } |
| 126 |
| 111 /** | 127 /** |
| 112 * The interface `InstrumentationBuilder` defines the behavior of objects used t
o collect data | 128 * 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. | 129 * about an operation that has occurred and record that data through an instrume
ntation logger. |
| 114 * | 130 * |
| 115 * For an example of using objects that implement this interface, see [Instrumen
tation]. | 131 * For an example of using objects that implement this interface, see [Instrumen
tation]. |
| 116 * | 132 * |
| 117 * @coverage dart.engine.utilities | 133 * @coverage dart.engine.utilities |
| 118 */ | 134 */ |
| 119 abstract class InstrumentationBuilder { | 135 abstract class InstrumentationBuilder { |
| 120 | |
| 121 /** | 136 /** |
| 122 * Append the given data to the data being collected by this builder. The info
rmation is declared | 137 * 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 | 138 * to potentially contain data that is either user identifiable or contains us
er intellectual |
| 124 * property (but is not guaranteed to contain either). | 139 * property (but is not guaranteed to contain either). |
| 125 * | 140 * |
| 126 * @param name the name used to identify the data | 141 * @param name the name used to identify the data |
| 127 * @param value the value of the data to be collected | 142 * @param value the value of the data to be collected |
| 128 * @return this builder | 143 * @return this builder |
| 129 */ | 144 */ |
| 130 InstrumentationBuilder data(String name, bool value); | 145 InstrumentationBuilder data(String name, bool value); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 * Append the given exception to the information being collected by this build
er. The exception's | 249 * 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 | 250 * 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 | 251 * 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 | 252 * guaranteed to contain either) and thus are captured using the various data
methods such as |
| 238 * [data]. | 253 * [data]. |
| 239 * | 254 * |
| 240 * @param exception the exception (may be `null`) | 255 * @param exception the exception (may be `null`) |
| 241 */ | 256 */ |
| 242 InstrumentationBuilder record(Exception exception); | 257 InstrumentationBuilder record(Exception exception); |
| 243 } | 258 } |
| 259 |
| 244 /** | 260 /** |
| 245 * The instrumentation recording level representing (1) recording [EVERYTHING] r
ecording of | 261 * The instrumentation recording level representing (1) recording [EVERYTHING] r
ecording of |
| 246 * all instrumentation data, (2) recording only [METRICS] information, or (3) re
cording | 262 * all instrumentation data, (2) recording only [METRICS] information, or (3) re
cording |
| 247 * turned [OFF] in which case nothing is recorded. | 263 * turned [OFF] in which case nothing is recorded. |
| 248 * | 264 * |
| 249 * @coverage dart.engine.utilities | 265 * @coverage dart.engine.utilities |
| 250 */ | 266 */ |
| 251 class InstrumentationLevel extends Enum<InstrumentationLevel> { | 267 class InstrumentationLevel extends Enum<InstrumentationLevel> { |
| 252 | |
| 253 /** Recording all instrumented information */ | 268 /** Recording all instrumented information */ |
| 254 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); | 269 static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERY
THING', 0); |
| 255 | 270 |
| 256 /** Recording only metrics */ | 271 /** Recording only metrics */ |
| 257 static final InstrumentationLevel METRICS = new InstrumentationLevel('METRICS'
, 1); | 272 static final InstrumentationLevel METRICS = new InstrumentationLevel('METRICS'
, 1); |
| 258 | 273 |
| 259 /** Nothing recorded */ | 274 /** Nothing recorded */ |
| 260 static final InstrumentationLevel OFF = new InstrumentationLevel('OFF', 2); | 275 static final InstrumentationLevel OFF = new InstrumentationLevel('OFF', 2); |
| 276 |
| 261 static final List<InstrumentationLevel> values = [EVERYTHING, METRICS, OFF]; | 277 static final List<InstrumentationLevel> values = [EVERYTHING, METRICS, OFF]; |
| 278 |
| 262 static InstrumentationLevel fromString(String str) { | 279 static InstrumentationLevel fromString(String str) { |
| 263 if (str == "EVERYTHING") { | 280 if (str == "EVERYTHING") { |
| 264 return InstrumentationLevel.EVERYTHING; | 281 return InstrumentationLevel.EVERYTHING; |
| 265 } | 282 } |
| 266 if (str == "METRICS") { | 283 if (str == "METRICS") { |
| 267 return InstrumentationLevel.METRICS; | 284 return InstrumentationLevel.METRICS; |
| 268 } | 285 } |
| 269 if (str == "OFF") { | 286 if (str == "OFF") { |
| 270 return InstrumentationLevel.OFF; | 287 return InstrumentationLevel.OFF; |
| 271 } | 288 } |
| 272 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); | 289 throw new IllegalArgumentException("Unrecognised InstrumentationLevel"); |
| 273 } | 290 } |
| 291 |
| 274 InstrumentationLevel(String name, int ordinal) : super(name, ordinal); | 292 InstrumentationLevel(String name, int ordinal) : super(name, ordinal); |
| 275 } | 293 } |
| 294 |
| 276 /** | 295 /** |
| 277 * The interface `InstrumentationLogger` defines the behavior of objects that ar
e used to log | 296 * The interface `InstrumentationLogger` defines the behavior of objects that ar
e used to log |
| 278 * instrumentation data. | 297 * instrumentation data. |
| 279 * | 298 * |
| 280 * For an example of using objects that implement this interface, see [Instrumen
tation]. | 299 * For an example of using objects that implement this interface, see [Instrumen
tation]. |
| 281 * | 300 * |
| 282 * @coverage dart.engine.utilities | 301 * @coverage dart.engine.utilities |
| 283 */ | 302 */ |
| 284 abstract class InstrumentationLogger { | 303 abstract class InstrumentationLogger { |
| 285 | |
| 286 /** | 304 /** |
| 287 * Create a builder that can collect the data associated with an operation ide
ntified by the given | 305 * Create a builder that can collect the data associated with an operation ide
ntified by the given |
| 288 * name. | 306 * name. |
| 289 * | 307 * |
| 290 * @param name the name used to uniquely identify the operation | 308 * @param name the name used to uniquely identify the operation |
| 291 * @return the builder that was created | 309 * @return the builder that was created |
| 292 */ | 310 */ |
| 293 InstrumentationBuilder createBuilder(String name); | 311 InstrumentationBuilder createBuilder(String name); |
| 294 } | 312 } |
| OLD | NEW |