| 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");
|
| + }
|
| }
|
|
|
| }
|
|
|