689df106017bea01be7f3f2a234db036ed4047a2
[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
22         System.out.println("Sleeping......");
23
24          try {
25             Thread.sleep(10000);
26         } catch (Exception e) {
27
28         }
29
30         System.out.println("Pulling......");
31         long stop1 = System.currentTimeMillis();
32
33         t1.update();
34         long stop2 = System.currentTimeMillis();
35
36         System.out.println("Done......");
37         System.out.println(stop1 - start);
38         System.out.println(stop2 - stop1);
39
40         // t1.startTransaction();
41         // t1.addKV(ipingTimerKey, ipingTimer);
42         // t1.addKV(ia1, senDat);
43         // t1.commitTransaction();
44
45
46
47
48
49         // String pingTimerKey = "sensorController";
50         // IoTString ipingTimerKey = new IoTString(pingTimerKey);
51
52         // String a1 = "sensor";
53         // IoTString ia1 = new IoTString(a1);
54
55
56         // System.out.println("Starting System");
57
58
59
60
61         // while (true) {
62         //     try {
63
64
65
66         //         // Runtime runTime = Runtime.getRuntime();
67         //         // // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp | tr -d 'temp=' |  tr -d \"'C\"");
68         //         // Process proc = runTime.exec("/opt/vc/bin/vcgencmd measure_temp");
69         //         // BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
70         //         // String line = null;
71         //         // String dat = "";
72         //         // while ((line = reader.readLine()) != null) {
73         //         //     System.out.println(line);
74         //         //     dat = line;
75         //         // }
76         //         // reader.close();
77
78
79
80         //         // String pingTimer = Long.toString(System.currentTimeMillis());
81         //         // IoTString ipingTimer = new IoTString(pingTimer);
82
83
84         //         IoTString senDat = new IoTString(dat);
85
86         //         t1.update();
87         //         t1.startTransaction();
88         //         t1.addKV(ipingTimerKey, ipingTimer);
89         //         t1.addKV(ia1, senDat);
90         //         t1.commitTransaction();
91
92
93
94
95
96
97
98         //         Thread.sleep(5000);
99
100         //     } catch (Error e) {
101         //         e.printStackTrace();
102
103         //         Runtime runTime = Runtime.getRuntime();
104         //         runTime.exec("gpio mode 4 out");
105
106
107         //         while (true) {
108         //             runTime.exec("gpio write 4 1");
109         //             Thread.sleep(500);
110         //             runTime.exec("gpio write 4 0");
111         //             Thread.sleep(500);
112         //         }
113         //     }
114         // }
115     }
116 }