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

Unified Diff: pkg/analyzer/lib/src/generated/instrumentation.dart

Issue 259773005: New analyzer snapshot. Sorted unit members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/index.dart ('k') | pkg/analyzer/lib/src/generated/java_core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/instrumentation.dart
diff --git a/pkg/analyzer/lib/src/generated/instrumentation.dart b/pkg/analyzer/lib/src/generated/instrumentation.dart
index a64715688dc2ed477375b74212a01d5165115d88..c21a997922bfd4fac831f86d54c54077886f3e59 100644
--- a/pkg/analyzer/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer/lib/src/generated/instrumentation.dart
@@ -10,53 +10,95 @@ library engine.instrumentation;
import 'java_core.dart';
/**
- * The interface `InstrumentationLogger` defines the behavior of objects that are used to log
- * instrumentation data.
+ * The class `Instrumentation` implements support for logging instrumentation information.
*
- * For an example of using objects that implement this interface, see [Instrumentation].
+ * Instrumentation information consists of information about specific operations. Those operations
+ * can range from user-facing operations, such as saving the changes to a file, to internal
+ * operations, such as tokenizing source code. The information to be logged is gathered by
+ * [InstrumentationBuilder], created by one of the static methods on
+ * this class such as [builder] or [builder].
+ *
+ * Note, however, that until an instrumentation logger is installed using the method
+ * [setLogger], all instrumentation data will be lost.
+ *
+ * <b>Example</b>
+ *
+ * To collect metrics about how long it took to save a file, you would write something like the
+ * following:
+ *
+ * <pre>
+ * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClass());
+ * // save the file
+ * instrumentation.metric("chars", fileLength).log();
+ * </pre>
+ * The `Instrumentation.builder` method creates a new [InstrumentationBuilder
+ ] and records the time at which it was created. The
+ * [InstrumentationBuilder#metric] appends the information specified by the
+ * arguments and records the time at which the method is called so that the time to complete the
+ * save operation can be calculated. The `log` method tells the builder that all of the data
+ * has been collected and that the resulting information should be logged.
*/
-abstract class InstrumentationLogger {
+class Instrumentation {
/**
- * Create a builder that can collect the data associated with an operation identified by the given
- * name.
+ * A builder that will silently ignore all data and logging requests.
+ */
+ static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER();
+
+ /**
+ * An instrumentation logger that can be used when no other instrumentation logger has been
+ * configured. This logger will silently ignore all data and logging requests.
+ */
+ static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_Instrumentation_NULL_LOGGER();
+
+ /**
+ * The current instrumentation logger.
+ */
+ static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER;
+
+ /**
+ * Create a builder that can collect the data associated with an operation.
*
- * @param name the name used to uniquely identify the operation
- * @return the builder that was created
+ * @param clazz the class performing the operation (not `null`)
+ * @return the builder that was created (not `null`)
*/
- InstrumentationBuilder createBuilder(String name);
-}
+ static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBuilder(clazz.toString());
-/**
- * The instrumentation recording level representing (1) recording [EVERYTHING] recording of
- * all instrumentation data, (2) recording only [METRICS] information, or (3) recording
- * turned [OFF] in which case nothing is recorded.
- */
-class InstrumentationLevel extends Enum<InstrumentationLevel> {
- /** Recording all instrumented information */
- static const InstrumentationLevel EVERYTHING = const InstrumentationLevel('EVERYTHING', 0);
+ /**
+ * Create a builder that can collect the data associated with an operation.
+ *
+ * @param name the name used to uniquely identify the operation (not `null`)
+ * @return the builder that was created (not `null`)
+ */
+ static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createBuilder(name);
- /** Recording only metrics */
- static const InstrumentationLevel METRICS = const InstrumentationLevel('METRICS', 1);
+ /**
+ * Get the currently active instrumentation logger
+ */
+ static InstrumentationLogger get logger => _CURRENT_LOGGER;
- /** Nothing recorded */
- static const InstrumentationLevel OFF = const InstrumentationLevel('OFF', 2);
+ /**
+ * Return a builder that will silently ignore all data and logging requests.
+ *
+ * @return the builder (not `null`)
+ */
+ static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER;
- static const List<InstrumentationLevel> values = const [EVERYTHING, METRICS, OFF];
+ /**
+ * Is this instrumentation system currently configured to drop instrumentation data provided to
+ * it?
+ *
+ * @return
+ */
+ static bool get isNullLogger => identical(_CURRENT_LOGGER, _NULL_LOGGER);
- static InstrumentationLevel fromString(String str) {
- if (str == "EVERYTHING") {
- return InstrumentationLevel.EVERYTHING;
- }
- if (str == "METRICS") {
- return InstrumentationLevel.METRICS;
- }
- if (str == "OFF") {
- return InstrumentationLevel.OFF;
- }
- throw new IllegalArgumentException("Unrecognised InstrumentationLevel");
+ /**
+ * Set the logger that should receive instrumentation information to the given logger.
+ *
+ * @param logger the logger that should receive instrumentation information
+ */
+ static void set logger(InstrumentationLogger logger) {
+ _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger;
}
-
- const InstrumentationLevel(String name, int ordinal) : super(name, ordinal);
}
/**
@@ -190,98 +232,6 @@ abstract class InstrumentationBuilder {
InstrumentationBuilder record(Exception exception);
}
-/**
- * The class `Instrumentation` implements support for logging instrumentation information.
- *
- * Instrumentation information consists of information about specific operations. Those operations
- * can range from user-facing operations, such as saving the changes to a file, to internal
- * operations, such as tokenizing source code. The information to be logged is gathered by
- * [InstrumentationBuilder], created by one of the static methods on
- * this class such as [builder] or [builder].
- *
- * Note, however, that until an instrumentation logger is installed using the method
- * [setLogger], all instrumentation data will be lost.
- *
- * <b>Example</b>
- *
- * To collect metrics about how long it took to save a file, you would write something like the
- * following:
- *
- * <pre>
- * InstrumentationBuilder instrumentation = Instrumentation.builder(this.getClass());
- * // save the file
- * instrumentation.metric("chars", fileLength).log();
- * </pre>
- * The `Instrumentation.builder` method creates a new [InstrumentationBuilder
- ] and records the time at which it was created. The
- * [InstrumentationBuilder#metric] appends the information specified by the
- * arguments and records the time at which the method is called so that the time to complete the
- * save operation can be calculated. The `log` method tells the builder that all of the data
- * has been collected and that the resulting information should be logged.
- */
-class Instrumentation {
- /**
- * A builder that will silently ignore all data and logging requests.
- */
- static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER();
-
- /**
- * An instrumentation logger that can be used when no other instrumentation logger has been
- * configured. This logger will silently ignore all data and logging requests.
- */
- static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_Instrumentation_NULL_LOGGER();
-
- /**
- * The current instrumentation logger.
- */
- static InstrumentationLogger _CURRENT_LOGGER = _NULL_LOGGER;
-
- /**
- * Create a builder that can collect the data associated with an operation.
- *
- * @param clazz the class performing the operation (not `null`)
- * @return the builder that was created (not `null`)
- */
- static InstrumentationBuilder builder(Type clazz) => _CURRENT_LOGGER.createBuilder(clazz.toString());
-
- /**
- * Create a builder that can collect the data associated with an operation.
- *
- * @param name the name used to uniquely identify the operation (not `null`)
- * @return the builder that was created (not `null`)
- */
- static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createBuilder(name);
-
- /**
- * Get the currently active instrumentation logger
- */
- static InstrumentationLogger get logger => _CURRENT_LOGGER;
-
- /**
- * Return a builder that will silently ignore all data and logging requests.
- *
- * @return the builder (not `null`)
- */
- static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER;
-
- /**
- * Is this instrumentation system currently configured to drop instrumentation data provided to
- * it?
- *
- * @return
- */
- static bool get isNullLogger => identical(_CURRENT_LOGGER, _NULL_LOGGER);
-
- /**
- * Set the logger that should receive instrumentation information to the given logger.
- *
- * @param logger the logger that should receive instrumentation information
- */
- static void set logger(InstrumentationLogger logger) {
- _CURRENT_LOGGER = logger == null ? _NULL_LOGGER : logger;
- }
-}
-
class InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER implements InstrumentationBuilder {
@override
InstrumentationBuilder data(String name, bool value) => this;
@@ -322,6 +272,56 @@ class InstrumentationBuilder_Instrumentation_NULL_INSTRUMENTATION_BUILDER implem
InstrumentationBuilder record(Exception exception) => this;
}
+/**
+ * The instrumentation recording level representing (1) recording [EVERYTHING] recording of
+ * all instrumentation data, (2) recording only [METRICS] information, or (3) recording
+ * turned [OFF] in which case nothing is recorded.
+ */
+class InstrumentationLevel extends Enum<InstrumentationLevel> {
+ /** Recording all instrumented information */
+ static const InstrumentationLevel EVERYTHING = const InstrumentationLevel('EVERYTHING', 0);
+
+ /** Recording only metrics */
+ static const InstrumentationLevel METRICS = const InstrumentationLevel('METRICS', 1);
+
+ /** Nothing recorded */
+ static const InstrumentationLevel OFF = const InstrumentationLevel('OFF', 2);
+
+ static const List<InstrumentationLevel> values = const [EVERYTHING, METRICS, OFF];
+
+ static InstrumentationLevel fromString(String str) {
+ if (str == "EVERYTHING") {
+ return InstrumentationLevel.EVERYTHING;
+ }
+ if (str == "METRICS") {
+ return InstrumentationLevel.METRICS;
+ }
+ if (str == "OFF") {
+ return InstrumentationLevel.OFF;
+ }
+ throw new IllegalArgumentException("Unrecognised InstrumentationLevel");
+ }
+
+ const InstrumentationLevel(String name, int ordinal) : super(name, ordinal);
+}
+
+/**
+ * The interface `InstrumentationLogger` defines the behavior of objects that are used to log
+ * instrumentation data.
+ *
+ * For an example of using objects that implement this interface, see [Instrumentation].
+ */
+abstract class InstrumentationLogger {
+ /**
+ * Create a builder that can collect the data associated with an operation identified by the given
+ * name.
+ *
+ * @param name the name used to uniquely identify the operation
+ * @return the builder that was created
+ */
+ InstrumentationBuilder createBuilder(String name);
+}
+
class InstrumentationLogger_Instrumentation_NULL_LOGGER implements InstrumentationLogger {
@override
InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INSTRUMENTATION_BUILDER;
« no previous file with comments | « pkg/analyzer/lib/src/generated/index.dart ('k') | pkg/analyzer/lib/src/generated/java_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698