Phone app (based on Ali's Control for iotcloud benchmark) to control alarm in the...
[iot2.git] / benchmarks / other / PhoneInterface / Control / app / src / main / java / iotcloud / TimingSingleton.java
diff --git a/benchmarks/other/PhoneInterface/Control/app/src/main/java/iotcloud/TimingSingleton.java b/benchmarks/other/PhoneInterface/Control/app/src/main/java/iotcloud/TimingSingleton.java
new file mode 100644 (file)
index 0000000..c3ce863
--- /dev/null
@@ -0,0 +1,33 @@
+package iotcloud;
+
+
+class TimingSingleton {
+    private static TimingSingleton singleton = new TimingSingleton( );
+    private static long startTime = 0;
+
+    private static long totalTime = 0;
+
+    private TimingSingleton() {
+
+    }
+
+    public static TimingSingleton getInstance( ) {
+        return singleton;
+    }
+
+
+    public static void startTime( ) {
+        startTime = System.nanoTime();
+    }
+
+    public static void endTime( ) {
+        totalTime += System.nanoTime() - startTime;
+
+    }
+
+    public static long getTime( ) {
+        return totalTime;
+    }
+
+
+}
\ No newline at end of file