summaryrefslogtreecommitdiff
path: root/java/JACE/Timers/ProfileTimer.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/JACE/Timers/ProfileTimer.java')
-rw-r--r--java/JACE/Timers/ProfileTimer.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/java/JACE/Timers/ProfileTimer.java b/java/JACE/Timers/ProfileTimer.java
new file mode 100644
index 00000000000..210d8887907
--- /dev/null
+++ b/java/JACE/Timers/ProfileTimer.java
@@ -0,0 +1,46 @@
+/*************************************************
+ *
+ * = PACKAGE
+ * JACE.Timers
+ *
+ * = FILENAME
+ * ProfileTimer.java
+ *
+ *@author Prashant Jain
+ *
+ *************************************************/
+package JACE.Timers;
+
+/**
+ * A Java wrapper for interval timers.
+ */
+public class ProfileTimer
+{
+ /**
+ * Start the timer.
+ */
+ public void start ()
+ {
+ this.startTime_ = java.lang.System.currentTimeMillis ();
+ }
+
+ /**
+ * Stop the timer.
+ */
+ public void stop ()
+ {
+ this.stopTime_ = java.lang.System.currentTimeMillis ();
+ }
+
+ /**
+ * Determine elapsed time between start and stop.
+ *@return Total elapsed time (stop - start).
+ */
+ public long elapsedTime ()
+ {
+ return this.stopTime_ - this.startTime_;
+ }
+
+ private long startTime_;
+ private long stopTime_;
+}