Thread.sleep(1000);
}
+
for (int i = 2500; i < 9000; i += 100) {
System.out.println("Adjusting Temp: " + Integer.toString(i));
lifx.setTemperature(i);
PHONY += run-compiler-dev
run-compiler-dev:
cp ../localconfig/iotpolicy/development/*.pol $(BIN_DIR)/iotpolicy/
- #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
+ #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_profiling.pol testclassrequires_profiling.pol -cplus Cplus -java Java
+ cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
#cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
#cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_callbacks.pol testclassrequires_callbacks.pol -cplus Cplus -java Java
- cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_callbacks.pol testclassrequires_callbacks.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
+ #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_callbacks.pol testclassrequires_callbacks.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
#cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_callbacks_three.pol testclassrequires_callbacks_three.pol callbackpolicy.pol callbackrequires.pol callbackpolicy_two.pol callbackrequires_two.pol -cplus Cplus -java Java
#cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
- #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
-# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
+ cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_ProfilingStub.java
+ cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
+ #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
#cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassCallbacks_Stub.java
- cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassInterface_Skeleton.java -Xlint:unchecked
- cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassComplete_Stub.java -Xlint:unchecked
- cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_Stub.java -Xlint:unchecked
- cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_Skeleton.java -Xlint:unchecked
+# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassInterface_Skeleton.java -Xlint:unchecked
+# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassComplete_Stub.java -Xlint:unchecked
+# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_Stub.java -Xlint:unchecked
+# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_Skeleton.java -Xlint:unchecked
# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_CallbackSkeleton.java
# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_CallbackStub.java
- cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
- cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassComplete_Stub.cpp -o ./TestClassComplete_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+ #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+ #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassComplete_Stub.cpp -o ./TestClassComplete_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
#cp ./iotrmi/C++/ConcurrentLinkedListQueue.cpp $(BIN_DIR)/iotpolicy/output_files/Cplus
#cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./ConcurrentLinkedListQueue.cpp -o ./ConcurrentLinkedListQueue.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
PHONY += run-java-stub
run-java-stub:
+ cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_ProfilingStub
# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Stub
# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassAdvanced_Stub
- cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassCallbacks_Stub
+# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassCallbacks_Stub
PHONY += run-cplus-skeleton
run-cplus-skeleton:
int portRecv = 6000;
const char* address = "localhost";
//const char* address = "192.168.2.191"; // RPi2
- //const char* skeletonAddress = "128.195.136.170"; // dc-9.calit2.uci.edu
- const char* skeletonAddress = "128.195.204.132";
+ const char* skeletonAddress = "128.195.136.163"; // dc-2.calit2.uci.edu
+ //const char* skeletonAddress = "128.195.204.132";
const char* callbackAddress = "128.195.204.132"; // dw-2.eecs.uci.edu (this machine)
//const char* skeletonAddress = "192.168.2.108"; // RPi1
//const char* callbackAddress = "192.168.2.191"; // RPi2
//ports.push_back(43212);
TestClassComplete *tcStub = new TestClassComplete_Stub(portSend, portRecv, skeletonAddress, rev, &bResult);
+ vector<char> in;
+ in.push_back(68);
+ in.push_back(68);
+ vector<char> result = tcStub->getByteArray(in);
+ cout << "Test print: " << in[0] << endl;
+/*
// cout << "Getting return value from getShort(): " << tcStub->getShort(1234) << endl;
//cout << "Getting return value from getShort(): " << tcStub->getShort(4321) << endl;
//cout << "Getting return value from getShort(): " << tcStub->getShort(5678) << endl;
//cout << "Return value from callback: " << tcStub->callBack() << endl;
// TODO: we need this while loop at the end to keep the threads running
- while(true);
+ while(true);*/
return 0;
}
int portRecv = 6000;
//TestClassInterface *tc = new TestClass(argv2, argv3, argv4);
TestClassInterface *tc = new TestClass(123, 2.345, "test");
+ //TestClassInterface *tc = new TestClassProfiling();
TestClassInterface_Skeleton *tcSkel = new TestClassInterface_Skeleton(tc, portSend, portRecv);
//delete tc;
--- /dev/null
+#ifndef _TESTCLASS_HPP__
+#define _TESTCLASS_HPP__
+
+#include <iostream>
+#include <thread>
+#include <chrono>
+#include "TestClassInterface.hpp"
+#include "CallBackInterfaceWithCallBack.hpp"
+#include "Enum.hpp"
+#include "Struct.hpp"
+
+using namespace std;
+
+class TestClassProfiling : public TestClassInterface {
+ public:
+ TestClassProfiling();
+
+ vector<char> getByteArray(vector<char> in);
+
+};
+
+
+TestClassProfiling::TestClassProfiling() {
+
+}
+
+// Arrays
+vector<char> TestClass::getByteArray(vector<char> in) {
+
+ return in;
+}
+
+
+#endif
+
TestClassInterface_Skeleton *tcSkel;
int port = 5010;
- tc = new TestClass(3, 5.0, "7911");
+ //tc = new TestClass(3, 5.0, "7911");
+ tc = new TestClassProfiling();
string callbackAddress = "128.195.204.132";
tcSkel = new TestClassInterface_Skeleton(tc, callbackAddress, port);
// Struct
public Struct handleStruct(Struct str) {
- System.out.println("Name: " + str.name);
- System.out.println("Value: " + str.value);
- System.out.println("Year: " + str.year);
+ //System.out.println("Name: " + str.name);
+ //System.out.println("Value: " + str.value);
+ //System.out.println("Year: " + str.year);
- Struct test = new Struct();
- test.name = "Anonymous";
- test.value = 1.33f;
- test.year = 2016;
+ //Struct test = new Struct();
+ //test.name = "Anonymous";
+ //test.value = 1.33f;
+ //test.year = 2016;
- str = test;
+ //str = test;
return str;
}
--- /dev/null
+public class TestClassProfiling implements TestClassInterface {
+
+ /**
+ * Constructors
+ */
+ public TestClassProfiling() {
+
+ }
+
+
+ // Arrays
+ public byte[] getByteArray(byte[] in) {
+
+ return in;
+ }
+}
\ No newline at end of file
--- /dev/null
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import iotruntime.master.CommunicationHandler;
+
+public class TestClass_ProfilingStub {
+
+ public static void main(String[] args) throws Exception {
+ CommunicationHandler comHan = new CommunicationHandler(true);
+ int numOfPorts = 2;
+ //int[] ports = comHan.getCallbackPorts(numOfPorts);
+
+ //int localportsend = 5011;
+ //int localportrecv = 6011;
+ int portsend = 5000;
+ int portrecv = 6000;
+ //String skeletonAddress = "128.195.136.163";
+ //String skeletonAddress = "128.195.204.132";
+ String skeletonAddress = "192.168.2.108";
+ //String callbackAddress = "128.195.204.132"; // dw-2.eecs.uci.edu (this machine)
+ String callbackAddress = "192.168.2.191";
+ int rev = 0;
+
+ //TestClassComplete_Stub tcstub = new TestClassComplete_Stub(localportsend, localportrecv, portsend, portrecv,
+ //skeletonAddress, rev);
+ TestClassComplete_Stub tcstub = new TestClassComplete_Stub(0, 0, portsend, portrecv, skeletonAddress, rev);
+ //byte[] in1 = { 68, 69 };
+ //int counter = 100;
+ //byte[] in1 = new byte[counter];
+ //for (int i=0; i<counter; i++)
+ // in1[i] = 68;
+ System.out.println("==== STRUCT ====");
+ Struct str = new Struct();
+ str.name = "Rahmadi";
+ str.value = 0.123f;
+ str.year = 2016;
+ // PROFILING
+ long start = 0;
+ long end = 0;
+ //byte[] returned = null;
+ int exp = 10;
+ long avg = 0;
+ //Struct strRes = null;
+ long longVar = 0;
+ long inVar = 1234;
+ double doubleVar = 0;
+ double inDouble = 1234.1234;
+ for (int i = 0; i < exp; i++) {
+ start = System.currentTimeMillis();
+ //start = System.nanoTime();
+ //System.out.println("Return value: " + Arrays.toString(tcstub.getByteArray(in1)));
+ //returned = tcstub.getByteArray(in1);
+ //strRes = tcstub.handleStruct(str);
+ //longVar = tcstub.getLong(inVar);
+ doubleVar = tcstub.getDouble(inDouble);
+ end = System.currentTimeMillis();
+ //end = System.nanoTime();
+ //long res = (end - start) / 1000;
+ long res = (end - start);
+ System.out.println("\n\n ==> Time: " + res);
+ //System.out.println("\n\n ==> Time: " + (end - start));
+ avg = avg + res;
+ }
+ System.out.println("Average: " + (avg / exp));
+ }
+
+}
int portsend = 5000;
int portrecv = 6000;
String callbackAddress = InetAddress.getLocalHost().getHostAddress();
- TestClass tc = new TestClass(3, 5f, "7911");
+ //TestClassProfiling tc = new TestClassProfiling();
+ TestClass tc = new TestClass();
TestClassInterface_Skeleton tcSkel = new TestClassInterface_Skeleton(tc, portsend, portrecv);
}
}
--- /dev/null
+public interface TestClassInterface {
+
+ public byte[] getByteArray(byte in[]);
+
+ capability All {
+ description = "All";
+ method = "getByteArray(byte in[])";
+ }
+}
+
+
--- /dev/null
+requires TestClassInterface with All as interface TestClassComplete;
\ No newline at end of file