From: rtrimana Date: Mon, 24 Apr 2017 23:06:22 +0000 (-0700) Subject: Changes and additional files for RMI profiling X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=302042de817d92a659f4e3015ec56cd4e382ee44 Changes and additional files for RMI profiling --- diff --git a/benchmarks/Java/Lifxtest/Lifxtest.java b/benchmarks/Java/Lifxtest/Lifxtest.java index 9786055..1c30714 100644 --- a/benchmarks/Java/Lifxtest/Lifxtest.java +++ b/benchmarks/Java/Lifxtest/Lifxtest.java @@ -44,6 +44,7 @@ public class Lifxtest { Thread.sleep(1000); } + for (int i = 2500; i < 9000; i += 100) { System.out.println("Adjusting Temp: " + Integer.toString(i)); lifx.setTemperature(i); diff --git a/iotjava/Makefile b/iotjava/Makefile index e44a4ba..2ff4d53 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -22,10 +22,11 @@ compiler: 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 @@ -139,18 +140,19 @@ compile: #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++/ @@ -168,9 +170,10 @@ run-java-skeleton: 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: diff --git a/iotjava/iotrmi/C++/basics/TestClassComplete_Stub.cpp b/iotjava/iotrmi/C++/basics/TestClassComplete_Stub.cpp index be174b8..96827a2 100644 --- a/iotjava/iotrmi/C++/basics/TestClassComplete_Stub.cpp +++ b/iotjava/iotrmi/C++/basics/TestClassComplete_Stub.cpp @@ -121,8 +121,8 @@ int main(int argc, char *argv[]) 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 @@ -135,6 +135,12 @@ int main(int argc, char *argv[]) //ports.push_back(43212); TestClassComplete *tcStub = new TestClassComplete_Stub(portSend, portRecv, skeletonAddress, rev, &bResult); + vector in; + in.push_back(68); + in.push_back(68); + vector 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; @@ -150,7 +156,7 @@ int main(int argc, char *argv[]) //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; } diff --git a/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp b/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp index 34e4709..b4f5c5b 100644 --- a/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp +++ b/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp @@ -173,6 +173,7 @@ int main(int argc, char *argv[]) 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; diff --git a/iotjava/iotrmi/C++/basics/TestClassProfiling.hpp b/iotjava/iotrmi/C++/basics/TestClassProfiling.hpp new file mode 100644 index 0000000..b15f092 --- /dev/null +++ b/iotjava/iotrmi/C++/basics/TestClassProfiling.hpp @@ -0,0 +1,35 @@ +#ifndef _TESTCLASS_HPP__ +#define _TESTCLASS_HPP__ + +#include +#include +#include +#include "TestClassInterface.hpp" +#include "CallBackInterfaceWithCallBack.hpp" +#include "Enum.hpp" +#include "Struct.hpp" + +using namespace std; + +class TestClassProfiling : public TestClassInterface { + public: + TestClassProfiling(); + + vector getByteArray(vector in); + +}; + + +TestClassProfiling::TestClassProfiling() { + +} + +// Arrays +vector TestClass::getByteArray(vector in) { + + return in; +} + + +#endif + diff --git a/iotjava/iotrmi/C++/basics/TestClass_Skeleton.cpp b/iotjava/iotrmi/C++/basics/TestClass_Skeleton.cpp index 5da9229..afb287e 100644 --- a/iotjava/iotrmi/C++/basics/TestClass_Skeleton.cpp +++ b/iotjava/iotrmi/C++/basics/TestClass_Skeleton.cpp @@ -11,7 +11,8 @@ int main(int argc, char *argv[]) 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); diff --git a/iotjava/iotrmi/Java/basics/TestClass.java b/iotjava/iotrmi/Java/basics/TestClass.java index f9666fe..6e9aea4 100644 --- a/iotjava/iotrmi/Java/basics/TestClass.java +++ b/iotjava/iotrmi/Java/basics/TestClass.java @@ -323,17 +323,17 @@ public class TestClass implements TestClassInterface { // 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; } diff --git a/iotjava/iotrmi/Java/basics/TestClassProfiling.java b/iotjava/iotrmi/Java/basics/TestClassProfiling.java new file mode 100644 index 0000000..4677bcc --- /dev/null +++ b/iotjava/iotrmi/Java/basics/TestClassProfiling.java @@ -0,0 +1,16 @@ +public class TestClassProfiling implements TestClassInterface { + + /** + * Constructors + */ + public TestClassProfiling() { + + } + + + // Arrays + public byte[] getByteArray(byte[] in) { + + return in; + } +} \ No newline at end of file diff --git a/iotjava/iotrmi/Java/basics/TestClass_ProfilingStub.java b/iotjava/iotrmi/Java/basics/TestClass_ProfilingStub.java new file mode 100644 index 0000000..dfe38ef --- /dev/null +++ b/iotjava/iotrmi/Java/basics/TestClass_ProfilingStub.java @@ -0,0 +1,67 @@ +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 Time: " + res); + //System.out.println("\n\n ==> Time: " + (end - start)); + avg = avg + res; + } + System.out.println("Average: " + (avg / exp)); + } + +} diff --git a/iotjava/iotrmi/Java/basics/TestClass_Skeleton.java b/iotjava/iotrmi/Java/basics/TestClass_Skeleton.java index c85842d..0e83e75 100644 --- a/iotjava/iotrmi/Java/basics/TestClass_Skeleton.java +++ b/iotjava/iotrmi/Java/basics/TestClass_Skeleton.java @@ -7,7 +7,8 @@ public class TestClass_Skeleton { 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); } } diff --git a/localconfig/iotpolicy/development/testclasspolicy_profiling.pol b/localconfig/iotpolicy/development/testclasspolicy_profiling.pol new file mode 100644 index 0000000..df74e0d --- /dev/null +++ b/localconfig/iotpolicy/development/testclasspolicy_profiling.pol @@ -0,0 +1,11 @@ +public interface TestClassInterface { + + public byte[] getByteArray(byte in[]); + + capability All { + description = "All"; + method = "getByteArray(byte in[])"; + } +} + + diff --git a/localconfig/iotpolicy/development/testclassrequires_profiling.pol b/localconfig/iotpolicy/development/testclassrequires_profiling.pol new file mode 100644 index 0000000..fb72e24 --- /dev/null +++ b/localconfig/iotpolicy/development/testclassrequires_profiling.pol @@ -0,0 +1 @@ +requires TestClassInterface with All as interface TestClassComplete; \ No newline at end of file