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