8033677c2e8be1d2f909ec9494991f70eddd3251
[iotcloud.git] / version2 / src / java / light_fan_embed_benchmark / Sensor.java
1 import iotcloud.*;
2 import java.util.*;
3 import java.lang.*;
4 import java.io.*;
5
6 class Sensor {
7     public static void main(String[] args) throws Exception {
8
9
10         Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 361, -1);
11
12         try {
13             Thread.sleep(5000);
14         } catch (Exception e) {
15
16         }
17
18         long start = System.currentTimeMillis();
19         t1.rebuild();
20         
21         long stop1 = System.currentTimeMillis();
22
23         t1.update();
24         long stop2 = System.currentTimeMillis();
25
26         System.out.println("Done......");
27         System.out.println(stop1 - start);
28         System.out.println(stop2 - stop1);
29
30         // t1.startTransaction();
31         // t1.addKV(ipingTimerKey, ipingTimer);
32         // t1.addKV(ia1, senDat);
33         // t1.commitTransaction();
34
35
36
37
38
39         // String pingTimerKey = "sensorController";
40         // IoTString ipingTimerKey = new IoTString(pingTimerKey);
41
42         // String a1 = "sensor";
43         // IoTString ia1 = new IoTString(a1);
44
45
46         // System.out.println("Starting System");
47
48
49
50
51         // while (true) {
52         //     try {
53
54
55
56         //         // Runtime runTime = Runtime.getRuntime();
57         //         // // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' |  tr -d \"'C\"");
58         //         // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
59         //         // BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
60         //         // String line = null;
61         //         // String dat = "";
62         //         // while ((line = reader.readLine()) != null) {
63         //         //     System.out.println(line);
64         //         //     dat = line;
65         //         // }
66         //         // reader.close();
67
68
69
70         //         // String pingTimer = Long.toString(System.currentTimeMillis());
71         //         // IoTString ipingTimer = new IoTString(pingTimer);
72
73
74         //         IoTString senDat = new IoTString(dat);
75
76         //         t1.update();
77         //         t1.startTransaction();
78         //         t1.addKV(ipingTimerKey, ipingTimer);
79         //         t1.addKV(ia1, senDat);
80         //         t1.commitTransaction();
81
82
83
84
85
86
87
88         //         Thread.sleep(5000);
89
90         //     } catch (Error e) {
91         //         e.printStackTrace();
92
93         //         Runtime runTime = Runtime.getRuntime();
94         //         runTime.exec("gpio mode 4 out");
95
96
97         //         while (true) {
98         //             runTime.exec("gpio write 4 1");
99         //             Thread.sleep(500);
100         //             runTime.exec("gpio write 4 0");
101         //             Thread.sleep(500);
102         //         }
103         //     }
104         // }
105     }
106 }