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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/general/Timer.java

Issue 11364134: Merge libv1. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error Created 8 years, 1 month 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
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/general/Timer.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/xml/model/XmlAttribute.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/general/Timer.java
similarity index 51%
copy from editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/xml/model/XmlAttribute.java
copy to editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/general/Timer.java
index 386b76e1c2c828f7a3d1b3846077040a44fef98f..aaeb95379589c7828e60c9f311f86ad715b0b670 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/xml/model/XmlAttribute.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/general/Timer.java
@@ -11,26 +11,32 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.dart.tools.ui.web.xml.model;
+
+package com.google.dart.tools.core.utilities.general;
+
+import com.google.dart.tools.core.DartCoreDebug;
+
+import java.text.NumberFormat;
/**
- * An xml model element. An XmlAttribute is owned by an XmlNode.
+ * A simple timer class. The output is controlled by an options flag.
*/
-public class XmlAttribute {
- private String name;
- private String value;
+public class Timer {
+ private final String name;
+ private final long startTime;
- public XmlAttribute(String name, String value) {
+ public Timer(String name) {
this.name = name;
- this.value = value;
+ this.startTime = System.nanoTime();
}
- public Object getName() {
- return name;
- }
+ public void stop() {
+ if (DartCoreDebug.PERF_TIMER) {
+ long elapsedMillis = (System.nanoTime() - startTime) / 1000000;
- public String getValue() {
- return value;
+ // "save in 100ms"
+ System.out.println(name + " in " + NumberFormat.getInstance().format(elapsedMillis) + "ms");
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698