PyORAm
[iotcloud.git] / version2 / src / java / light_fan_embed_benchmark / Sensor.java
index 611b664afa20b2cb83f0521dd380dc613fe5b689..8033677c2e8be1d2f909ec9494991f70eddd3251 100644 (file)
@@ -8,57 +8,76 @@ class Sensor {
 
 
         Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 361, -1);
+
+        try {
+            Thread.sleep(5000);
+        } catch (Exception e) {
+
+        }
+
+        long start = System.currentTimeMillis();
         t1.rebuild();
+        
+        long stop1 = System.currentTimeMillis();
 
+        t1.update();
+        long stop2 = System.currentTimeMillis();
 
+        System.out.println("Done......");
+        System.out.println(stop1 - start);
+        System.out.println(stop2 - stop1);
 
-        String pingTimerKey = "sensorController";
-        IoTString ipingTimerKey = new IoTString(pingTimerKey);
+        // t1.startTransaction();
+        // t1.addKV(ipingTimerKey, ipingTimer);
+        // t1.addKV(ia1, senDat);
+        // t1.commitTransaction();
 
-        String a1 = "sensor";
-        IoTString ia1 = new IoTString(a1);
 
 
-        System.out.println("Starting System");
 
 
+        // String pingTimerKey = "sensorController";
+        // IoTString ipingTimerKey = new IoTString(pingTimerKey);
 
+        // String a1 = "sensor";
+        // IoTString ia1 = new IoTString(a1);
 
-        while (true) {
-            try {
 
+        // System.out.println("Starting System");
 
 
-                Runtime runTime = Runtime.getRuntime();
-                // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' |  tr -d \"'C\"");
-                Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
-                BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
-                String line = null;
-                String dat = "";
-                while ((line = reader.readLine()) != null) {
-                    System.out.println(line);
-                    dat = line;
-                }
-                reader.close();
 
 
+        // while (true) {
+        //     try {
 
-                String pingTimer = Long.toString(System.currentTimeMillis());
-                IoTString ipingTimer = new IoTString(pingTimer);
 
 
-                IoTString senDat = new IoTString(dat);
+        //         // Runtime runTime = Runtime.getRuntime();
+        //         // // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' |  tr -d \"'C\"");
+        //         // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
+        //         // BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+        //         // String line = null;
+        //         // String dat = "";
+        //         // while ((line = reader.readLine()) != null) {
+        //         //     System.out.println(line);
+        //         //     dat = line;
+        //         // }
+        //         // reader.close();
 
-                t1.update();
-                t1.startTransaction();
-                t1.addKV(ipingTimerKey, ipingTimer);
-                t1.addKV(ia1, senDat);
-                t1.commitTransaction();
 
 
+        //         // String pingTimer = Long.toString(System.currentTimeMillis());
+        //         // IoTString ipingTimer = new IoTString(pingTimer);
 
 
+        //         IoTString senDat = new IoTString(dat);
 
+        //         t1.update();
+        //         t1.startTransaction();
+        //         t1.addKV(ipingTimerKey, ipingTimer);
+        //         t1.addKV(ia1, senDat);
+        //         t1.commitTransaction();
 
 
 
@@ -66,22 +85,22 @@ class Sensor {
 
 
 
-                Thread.sleep(5000);
+        //         Thread.sleep(5000);
 
-            } catch (Error e) {
-                e.printStackTrace();
+        //     } catch (Error e) {
+        //         e.printStackTrace();
 
-                Runtime runTime = Runtime.getRuntime();
-                runTime.exec("gpio mode 4 out");
+        //         Runtime runTime = Runtime.getRuntime();
+        //         runTime.exec("gpio mode 4 out");
 
 
-                while (true) {
-                    runTime.exec("gpio write 4 1");
-                    Thread.sleep(500);
-                    runTime.exec("gpio write 4 0");
-                    Thread.sleep(500);
-                }
-            }
-        }
+        //         while (true) {
+        //             runTime.exec("gpio write 4 1");
+        //             Thread.sleep(500);
+        //             runTime.exec("gpio write 4 0");
+        //             Thread.sleep(500);
+        //         }
+        //     }
+        // }
     }
 }
\ No newline at end of file