Skip to content
Snippets Groups Projects
Commit 82bb684d authored by NTUMBA WA NTUMBA Patient's avatar NTUMBA WA NTUMBA Patient
Browse files

Update message size

parent 76eb6b9a
No related branches found
No related tags found
No related merge requests found
Showing
with 403 additions and 105 deletions
{"invocation_address":"128.93.65.233","service_port":"9082", "subcomponent_port":"9082","subcomponent_address":"128.93.65.233"} {"invocation_address":"128.93.65.234","service_port":"9082", "subcomponent_port":"9082","subcomponent_address":"128.93.65.234"}
{"invocation_address":"128.93.65.234","service_port":"9129", "subcomponent_port":"9129","subcomponent_address":"128.93.65.234"} {"invocation_address":"128.93.64.90","service_port":"9129", "subcomponent_port":"9129","subcomponent_address":"128.93.64.90"}
{"invocation_address":"127.0.0.1","service_port":"1111","subcomponent_port":"1111","subcomponent_address":"127.0.0.1"} {"invocation_address":"128.93.64.90","service_port":"1111","subcomponent_port":"1111","subcomponent_address":"128.93.64.90"}
{"invocation_address":"127.0.0.1","service_port":"8891","subcomponent_port":"8891","subcomponent_address":"127.0.0.1","service_name":"","target_namespace":""} {"invocation_address":"128.93.64.1","service_port":"8891","subcomponent_port":"8891","subcomponent_address":"128.93.64.1","service_name":"","target_namespace":""}
{"invocation_address":"127.0.0.1","service_port":"9082", "subcomponent_port":"9082","subcomponent_address":"127.0.0.1"} {"invocation_address":"128.93.65.234","service_port":"9082", "subcomponent_port":"9082","subcomponent_address":"128.93.65.234"}
\ No newline at end of file \ No newline at end of file
{"invocation_address":"http://127.0.0.1:1111/","service_port":"1112","subcomponent_port":"9082","subcomponent_address":"127.0.0.1","service_name":"","target_namespace":""} {"invocation_address":"http://128.93.64.90:1111/","service_port":"1112","subcomponent_port":"9082","subcomponent_address":"128.93.64.90","service_name":"","target_namespace":""}
\ No newline at end of file \ No newline at end of file
...@@ -36,33 +36,33 @@ public class MessageGenerator { ...@@ -36,33 +36,33 @@ public class MessageGenerator {
jsonObject.put("lon_2", String.valueOf((LAT * System.nanoTime()))); jsonObject.put("lon_2", String.valueOf((LAT * System.nanoTime())));
jsonObject.put("temp_2", String.valueOf((TEMP * System.nanoTime()))); jsonObject.put("temp_2", String.valueOf((TEMP * System.nanoTime())));
jsonObject.put("lat_3", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_3", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_3", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_3", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_3", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_3", String.valueOf((TEMP * System.nanoTime())));
//
jsonObject.put("lat_4", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_4", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_4", String.valueOf((LAT * System.nanoTime()))); // jsonObject.put("lon_4", String.valueOf((LAT * System.nanoTime())));
jsonObject.put("temp_4", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_4", String.valueOf((TEMP * System.nanoTime())));
////
jsonObject.put("lat_5", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_5", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_5", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_5", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_5", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_5", String.valueOf((TEMP * System.nanoTime())));
//
jsonObject.put("lat_6", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_6", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_6", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_6", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_6", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_6", String.valueOf((TEMP * System.nanoTime())));
//
jsonObject.put("lat_7", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_7", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_7", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_7", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_7", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_7", String.valueOf((TEMP * System.nanoTime())));
//
jsonObject.put("lat_8", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_8", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_8", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_8", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_8", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_8", String.valueOf((TEMP * System.nanoTime())));
//
jsonObject.put("lat_9", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_9", String.valueOf((LAT * System.currentTimeMillis())));
jsonObject.put("lon_9", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_9", String.valueOf((LON * System.nanoTime())));
jsonObject.put("temp_9", String.valueOf((TEMP * System.nanoTime()))); // jsonObject.put("temp_9", String.valueOf((TEMP * System.nanoTime())));
// jsonObject.put("lat_10", String.valueOf((LAT * System.currentTimeMillis()))); // jsonObject.put("lat_10", String.valueOf((LAT * System.currentTimeMillis())));
// jsonObject.put("lon_10", String.valueOf((LON * System.nanoTime()))); // jsonObject.put("lon_10", String.valueOf((LON * System.nanoTime())));
...@@ -110,10 +110,11 @@ public class MessageGenerator { ...@@ -110,10 +110,11 @@ public class MessageGenerator {
jsonObject.put("op_name", "bridgeNextClosure"); jsonObject.put("op_name", "bridgeNextClosure");
String message = jsonObject.toJSONString();
setMessageLength(message);
this.message_id++; this.message_id++;
return message+"-"+this.message_id; String message = jsonObject.toJSONString()+"-"+this.message_id;
setMessageLength(message);
return message;
} }
...@@ -142,4 +143,12 @@ public class MessageGenerator { ...@@ -142,4 +143,12 @@ public class MessageGenerator {
} }
public static void main(String[] args) {
System.out.println("Testttts");
MessageGenerator msg = new MessageGenerator();
msg.getMessage();
System.out.println(" Size "+msg.length);
}
} }
...@@ -60,6 +60,30 @@ ...@@ -60,6 +60,30 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>MonitorSimple</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>eu.chorevolution.vsb.monitor.MonitorSimple</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>MonitorSimple</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -32,7 +32,6 @@ public class MeasureAgent { ...@@ -32,7 +32,6 @@ public class MeasureAgent {
private Measure measure = null; private Measure measure = null;
private String attribute = null; private String attribute = null;
private long deltaTimestamp = 0l; private long deltaTimestamp = 0l;
private ClockSync clockSync = null;
public MeasureAgent(String attribute, long localTimestamp, String address, int port) { public MeasureAgent(String attribute, long localTimestamp, String address, int port) {
...@@ -76,15 +75,6 @@ public class MeasureAgent { ...@@ -76,15 +75,6 @@ public class MeasureAgent {
} }
try {
clockSync = new ClockSync();
clockSync.startSync();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
computeDeltaTime(); computeDeltaTime();
} }
......
...@@ -26,15 +26,16 @@ public class MonitorMain { ...@@ -26,15 +26,16 @@ public class MonitorMain {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// if (args.length != 1) { if (args.length != 1) {
//
// System.err.println("Missing arguments"); System.err.println("Missing arguments");
// System.err.println("java -jar MonitorMain-jar-with-dependencies.jar steadystateTimer"); System.err.println("java -jar MonitorMain-jar-with-dependencies.jar steadystateTimer");
// System.exit(0); System.exit(0);
// } }
long waitSteadystate = 1000; ///Long.valueOf(args[0]); // long waitSteadystate = 1000;
ExperimentListener experimentListener = new ExperimentListener("StartExperiment", MonitorConstant.M2, "9006"); long waitMessagestate = Long.valueOf(args[0]);
ExperimentListener experimentListener = new ExperimentListener("StartExperiment", MonitorConstant.M1, "9006");
// //
...@@ -55,7 +56,7 @@ public class MonitorMain { ...@@ -55,7 +56,7 @@ public class MonitorMain {
// MeasureListener listener_4 = new MeasureListener("timestamp_5", MonitorConstant.MDefault, MonitorConstant.timestamp_5_port_listener,timestampMap); // MeasureListener listener_4 = new MeasureListener("timestamp_5", MonitorConstant.MDefault, MonitorConstant.timestamp_5_port_listener,timestampMap);
// MeasureListener listener_5 = new MeasureListener("timestamp_6", MonitorConstant.MDefault, MonitorConstant.timestamp_6_port_listener,timestampMap); // MeasureListener listener_5 = new MeasureListener("timestamp_6", MonitorConstant.MDefault, MonitorConstant.timestamp_6_port_listener,timestampMap);
System.out.println("Wait for steady state system..."); System.out.println("Starting...");
new java.util.Timer().schedule(new java.util.TimerTask() { new java.util.Timer().schedule(new java.util.TimerTask() {
@Override @Override
...@@ -64,12 +65,12 @@ public class MonitorMain { ...@@ -64,12 +65,12 @@ public class MonitorMain {
// TODO Auto-generated method stub // TODO Auto-generated method stub
long t0 = 0, t1 = 0, t2, t3 = 0, t4 = 0, t5 = 0; long t0 = 0, t1 = 0, t2, t3 = 0, t4 = 0, t5 = 0;
MeasureListener listener_0 = new MeasureListener("timestamp_1", MonitorConstant.M2, MonitorConstant.timestamp_1_port_listener,timestampMap); MeasureListener listener_0 = new MeasureListener("timestamp_1", MonitorConstant.M1, MonitorConstant.timestamp_1_port_listener,timestampMap);
MeasureListener listener_1 = new MeasureListener("timestamp_2", MonitorConstant.M3, MonitorConstant.timestamp_2_port_listener,timestampMap); MeasureListener listener_1 = new MeasureListener("timestamp_2", MonitorConstant.M2, MonitorConstant.timestamp_2_port_listener,timestampMap);
MeasureListener listener_2 = new MeasureListener("timestamp_3", MonitorConstant.M3, MonitorConstant.timestamp_3_port_listener,timestampMap); MeasureListener listener_2 = new MeasureListener("timestamp_3", MonitorConstant.M2, MonitorConstant.timestamp_3_port_listener,timestampMap);
MeasureListener listener_3 = new MeasureListener("timestamp_4", MonitorConstant.M1, MonitorConstant.timestamp_4_port_listener,timestampMap); MeasureListener listener_3 = new MeasureListener("timestamp_4", MonitorConstant.M4, MonitorConstant.timestamp_4_port_listener,timestampMap);
MeasureListener listener_4 = new MeasureListener("timestamp_5", MonitorConstant.M1, MonitorConstant.timestamp_5_port_listener,timestampMap); MeasureListener listener_4 = new MeasureListener("timestamp_5", MonitorConstant.M4, MonitorConstant.timestamp_5_port_listener,timestampMap);
MeasureListener listener_5 = new MeasureListener("timestamp_6", MonitorConstant.M4, MonitorConstant.timestamp_6_port_listener,timestampMap); MeasureListener listener_5 = new MeasureListener("timestamp_6", MonitorConstant.M3, MonitorConstant.timestamp_6_port_listener,timestampMap);
int style = DateFormat.MEDIUM; int style = DateFormat.MEDIUM;
DateFormat df = DateFormat.getDateInstance(style, Locale.US); DateFormat df = DateFormat.getDateInstance(style, Locale.US);
...@@ -106,7 +107,8 @@ public class MonitorMain { ...@@ -106,7 +107,8 @@ public class MonitorMain {
} }
try { try {
Thread.sleep(10000); System.out.print("Waiting for "+waitMessagestate);
Thread.sleep(waitMessagestate);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -128,6 +130,9 @@ public class MonitorMain { ...@@ -128,6 +130,9 @@ public class MonitorMain {
long BC1 = 0l; long BC1 = 0l;
long BC2 = 0l; long BC2 = 0l;
long EtoE = 0l; long EtoE = 0l;
long StoBC1 = 0l;
long BC1toBC2 = 0l;
long BC2toR = 0l;
// System.out.print("\t\t t0 \t\t \t\t t1 \t\t \t\t t2 \t\t \t\t t3 \t\t \t\t t4 \t\t \t\t t5 \t\t \t\t t1-t0 \t\t \t\t t2-t1 \t\t \t\t t3-t2 \t\t \t\t t4-t3 \t\t \t\t t5-t4 \t\t \t\t t5-t0 \t\t\n"); // System.out.print("\t\t t0 \t\t \t\t t1 \t\t \t\t t2 \t\t \t\t t3 \t\t \t\t t4 \t\t \t\t t5 \t\t \t\t t1-t0 \t\t \t\t t2-t1 \t\t \t\t t3-t2 \t\t \t\t t4-t3 \t\t \t\t t5-t4 \t\t \t\t t5-t0 \t\t\n");
...@@ -135,32 +140,39 @@ public class MonitorMain { ...@@ -135,32 +140,39 @@ public class MonitorMain {
Set set = timestampMap.entrySet(); Set set = timestampMap.entrySet();
Iterator iterator = set.iterator(); Iterator iterator = set.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
t0 = 0; if(experimentMsgReceive > 10000){
t1 = 0;
t2 = 0;
t3 = 0;
t4 = 0;
t5 = 0;
Map.Entry mentry = (Map.Entry) iterator.next();
System.out.print("Message ID : " + mentry.getKey()+"\t" );
Long[] time_array = (Long[]) mentry.getValue();
t0 = time_array[0];
t1 = time_array[1];
t2 = time_array[2];
t3 = time_array[3];
t4 = time_array[4];
t5 = time_array[5];
if(t0 != 0 && t1 != 0 && t2 != 0 && t3 != 0 && t4 != 0 && t5 != 0 ){
BC1 += (t2 - t1);
BC2 += (t4 - t3);
EtoE += (t5 - t0);
System.out.print(t0 + "\t" + t1 + "\t" + t2 + "\t" + t3 + "\t" + t4 + "\t" + t5 + "\t" + (t1 - t0) + "\t"
+ (t2 - t1) + "\t" + (t3 - t2) + "\t" + (t4 - t3) + "\t" + (t5 - t4) + "\t" + (t5 - t0) + "\n");
experimentMsgReceiveBestFitnesss++;
t0 = 0;
t1 = 0;
t2 = 0;
t3 = 0;
t4 = 0;
t5 = 0;
Map.Entry mentry = (Map.Entry) iterator.next();
//System.out.print("Message ID : " + mentry.getKey()+"\t" );
Long[] time_array = (Long[]) mentry.getValue();
t0 = time_array[0];
t1 = time_array[1];
t2 = time_array[2];
t3 = time_array[3];
t4 = time_array[4];
t5 = time_array[5];
if(t0 != 0 && t1 != 0 && t2 != 0 && t3 != 0 && t4 != 0 && t5 != 0 ){
BC1 += (t2 - t1);
BC2 += (t4 - t3);
EtoE += (t5 - t0);
StoBC1 += (t1 - t0);
BC1toBC2 += (t3 - t2);
BC2toR += (t5 - t4);
// System.out.print(t0 + "\t" + t1 + "\t" + t2 + "\t" + t3 + "\t" + t4 + "\t" + t5 + "\t" + (t1 - t0) + "\t"
// + (t2 - t1) + "\t" + (t3 - t2) + "\t" + (t4 - t3) + "\t" + (t5 - t4) + "\t" + (t5 - t0) + "\n");
experimentMsgReceiveBestFitnesss++;
}
} }
experimentMsgReceive++; experimentMsgReceive++;
} }
...@@ -174,6 +186,9 @@ public class MonitorMain { ...@@ -174,6 +186,9 @@ public class MonitorMain {
long AVG_BC1 = BC1 / (experimentMsgReceiveBestFitnesss); long AVG_BC1 = BC1 / (experimentMsgReceiveBestFitnesss);
long AVG_BC2 = BC2 / (experimentMsgReceiveBestFitnesss); long AVG_BC2 = BC2 / (experimentMsgReceiveBestFitnesss);
long AVG_EtoE = EtoE / (experimentMsgReceiveBestFitnesss); long AVG_EtoE = EtoE / (experimentMsgReceiveBestFitnesss);
long AVG_StoBC1 = StoBC1 / (experimentMsgReceiveBestFitnesss);
long AVG_BC1toBC2 = BC1toBC2 / (experimentMsgReceiveBestFitnesss);
long AVG_BC2toR = BC2toR / (experimentMsgReceiveBestFitnesss);
System.out.println("\n=========================================================== "); System.out.println("\n=========================================================== ");
System.out.println("Start time: " +start ); System.out.println("Start time: " +start );
...@@ -182,18 +197,21 @@ public class MonitorMain { ...@@ -182,18 +197,21 @@ public class MonitorMain {
System.out.println("Messages receive: " + experimentMsgReceive); System.out.println("Messages receive: " + experimentMsgReceive);
System.out.println("Messages lost: " + (experimentListener.experimentMsgCounter - experimentMsgReceive) ); System.out.println("Messages lost: " + (experimentListener.experimentMsgCounter - experimentMsgReceive) );
System.out.println("Messages take for computing : " +experimentMsgReceiveBestFitnesss ); System.out.println("Messages take for computing : " +experimentMsgReceiveBestFitnesss );
long effectiveDuration = experimentListener.experimentDuration - waitSteadystate; long effectiveDuration = (long)(1200000 + waitMessagestate);
System.out.println("Monitoring duration : " +effectiveDuration ); System.out.println("Monitoring duration : " +effectiveDuration );
System.out.println("Throughput : " + (double)( (double)experimentMsgReceive /(double)effectiveDuration) ); System.out.println("Throughput : " + (double)( (double)experimentMsgReceive /(double)effectiveDuration) );
System.out.println("Losses : " + ( (double) ((double)experimentListener.experimentMsgCounter / (double)experimentMsgReceive))); System.out.println("Losses : " + ( (double) ((double)experimentMsgReceive / (double) experimentListener.experimentMsgCounter)));
System.out.println("Message / seconde : " + experimentListener.experimentAvgMessagesSent ); System.out.println("Message / seconde : " + experimentListener.experimentAvgMessagesSent );
System.out.println("BC1 Avg latency: " + AVG_BC1 ); System.out.println("BC1 Avg latency: " + AVG_BC1 );
System.out.println("BC2 Avg latency: " + AVG_BC2 ); System.out.println("BC2 Avg latency: " + AVG_BC2 );
System.out.println("End to End Avg latency: " + AVG_EtoE ); System.out.println("End to End Avg latency: " + AVG_EtoE );
System.out.println("Sender t0 BC1 Avg latency: " + AVG_StoBC1 );
System.out.println("BC1 t0 BC2 Avg latency: " + AVG_BC1toBC2 );
System.out.println("BC2 t0 Receiver Avg latency: " + AVG_BC2toR );
System.out.println("=========================================================== \n"); System.out.println("=========================================================== \n");
} }
}, waitSteadystate); }, 10000);
} }
......
package eu.chorevolution.vsb.monitor;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import eu.chorevolution.vsb.listener.ExperimentListener;
import eu.chorevolution.vsb.listener.MeasureListener;
import eu.chorevolution.vsb.monitor.util.MonitorConstant;
/**
* Unit test for simple App.
*/
public class MonitorSimple {
public static void main(String[] args) {
// TODO Auto-generated method stub
if (args.length != 1) {
System.err.println("Missing arguments");
System.err.println("java -jar MonitorMain-jar-with-dependencies.jar steadystateTimer");
System.exit(0);
}
long waitSteadystate = Long.valueOf(args[0]);
//long waitSteadystate = 1000;
ExperimentListener experimentListener = new ExperimentListener("StartExperiment", MonitorConstant.M1, "9006");
HashMap<Integer, Long[]> timestampMap = new HashMap<Integer, Long[]>();
System.out.println("Wait for steady state system...");
new java.util.Timer().schedule(new java.util.TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
long t0 = 0, t1 = 0;
// MeasureListener listener_0 = new MeasureListener("timestamp_1", MonitorConstant.M1, MonitorConstant.timestamp_1_port_listener,timestampMap);
// MeasureListener listener_1 = new MeasureListener("timestamp_2", MonitorConstant.M2, MonitorConstant.timestamp_2_port_listener,timestampMap);
//
MeasureListener listener_4 = new MeasureListener("timestamp_5", MonitorConstant.M4, MonitorConstant.timestamp_5_port_listener,timestampMap);
MeasureListener listener_5 = new MeasureListener("timestamp_6", MonitorConstant.M3, MonitorConstant.timestamp_6_port_listener,timestampMap);
int style = DateFormat.MEDIUM;
DateFormat df = DateFormat.getDateInstance(style, Locale.US);
//
// listener_0.connect();
// listener_1.connect();
listener_4.connect();
listener_5.connect();
experimentListener.connect();
try{
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
long experimentMsgSent = 0l;
long experimentMsgReceive = 0l;
long experimentMsgReceiveBestFitnesss = 0l;
System.out.print("Start Monitoring.");
while (experimentListener.experimentRunning){
System.out.print(".");
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// experimentMsgReceive = listener_5.getContainer().size();
// listener_0.disconnect();
// listener_1.disconnect();
listener_4.disconnect();
listener_5.disconnect();
// MongoClient mongoClient = new MongoClient(new MongoClientURI("mongodb://localhost:27017"));
// DB database = mongoClient.getDB("experiments");
// DBCollection collection = database.getCollection("exp_websocket_rest_mqtt_05042017_585_100_distributed");
Date start = new Date(experimentListener.experimentStartTime);
Date complete = new Date(experimentListener.experimentCompleteTime);
long BC1 = 0l;
long BC2 = 0l;
long EtoE = 0l;
long StoBC1 = 0l;
long BC1toBC2 = 0l;
long BC2toR = 0l;
// System.out.print("\t\t t0 \t\t \t\t t1 \t\t \t\t t2 \t\t \t\t t3 \t\t \t\t t4 \t\t \t\t t5 \t\t \t\t t1-t0 \t\t \t\t t2-t1 \t\t \t\t t3-t2 \t\t \t\t t4-t3 \t\t \t\t t5-t4 \t\t \t\t t5-t0 \t\t\n");
Set set = timestampMap.entrySet();
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
t0 = 0;
t1 = 0;
Map.Entry mentry = (Map.Entry) iterator.next();
System.out.print("Message ID : " + mentry.getKey()+"\t" );
Long[] time_array = (Long[]) mentry.getValue();
t0 = time_array[4];
t1 = time_array[5];
if(t0 != 0 && t1 != 0 ){
EtoE += (t1 - t0);
System.out.print(t0 + "\t" + t1 + "\t" + (t1 - t0) + "\n");
experimentMsgReceiveBestFitnesss++;
}
experimentMsgReceive++;
}
// DBObject doc = new BasicDBObject().append("timestamp_0", t0).append("timestamp_1", t1)
// .append("timestamp_2", t2).append("timestamp_3", t3).append("timestamp_4", t4)
// .append("timestamp_5", t5).append("latency_bc_1", (t2 - t1)).append("latency_bc_2", (t4 - t3))
// .append("latency_end_to_end", (t5 - t0));
// collection.insert(doc);
long AVG_EtoE = EtoE / (experimentMsgReceiveBestFitnesss);
System.out.println("\n=========================================================== ");
System.out.println("Start time: " +start );
System.out.println("Finish time: " +complete );
System.out.println("Messages sent: " + experimentListener.experimentMsgCounter );
System.out.println("Messages receive: " + experimentMsgReceive);
System.out.println("Messages lost: " + (experimentListener.experimentMsgCounter - experimentMsgReceive) );
System.out.println("Messages take for computing : " +experimentMsgReceiveBestFitnesss );
long effectiveDuration = 1200000 - waitSteadystate;
System.out.println("Monitoring duration : " +effectiveDuration );
System.out.println("Throughput : " + (double)( (double)experimentMsgReceive /(double)effectiveDuration) );
System.out.println("Losses : " + ( (double) ((double)experimentMsgReceive / (double) experimentListener.experimentMsgCounter)));
System.out.println("Message / seconde : " + experimentListener.experimentAvgMessagesSent );
System.out.println("End to End Avg latency: " + AVG_EtoE );
System.out.println("=========================================================== \n");
}
}, waitSteadystate);
}
}
...@@ -3,20 +3,20 @@ package eu.chorevolution.vsb.monitor.util; ...@@ -3,20 +3,20 @@ package eu.chorevolution.vsb.monitor.util;
public class MonitorConstant { public class MonitorConstant {
// public static final String TIME_SERVER = "128.93.64.246"; public static final String TIME_SERVER = "128.93.64.246";
// public static final String M1 = "128.93.65.234"; public static final String M1 = "128.93.65.234";
// public static final String M2 = "128.93.65.233"; public static final String M2 = "128.93.65.233";
// public static final String M3 = "128.93.64.1"; public static final String M3 = "128.93.64.1";
// public static final String M4 = "128.93.64.90"; public static final String M4 = "128.93.64.90";
// public static final String MDefault = "127.0.0.1";
public static final String TIME_SERVER = "127.0.0.1";
public static final String M1 = "127.0.0.1";
public static final String M2 = "127.0.0.1";
public static final String M3 = "127.0.0.1";
public static final String M4 = "127.0.0.1";
public static final String MDefault = "127.0.0.1"; public static final String MDefault = "127.0.0.1";
// public static final String TIME_SERVER = "127.0.0.1";
// public static final String M1 = "127.0.0.1";
// public static final String M2 = "127.0.0.1";
// public static final String M3 = "127.0.0.1";
// public static final String M4 = "127.0.0.1";
// public static final String MDefault = "127.0.0.1";
public static final int TIME_SERVER_PORT = 9999; public static final int TIME_SERVER_PORT = 9999;
public static final int timestamp_1_port_listener = 9000; public static final int timestamp_1_port_listener = 9000;
public static final int timestamp_2_port_listener = 9001; public static final int timestamp_2_port_listener = 9001;
......
#!/bin/bash
process="java"
ps aux | grep $process | grep -v grep | awk 'BEGIN { sum=0 } {sum=sum+$6; } END {printf("Memory used: %s Mo\n",sum / 1024)}'
echo -n " CPU Used : "
top -n1 -b | grep $process | cut -c43-45 | paste -sd+ | bc | cut -d "." -f1
package eu.chorevolution.vsb.playgrounds.clientserver.rest;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import org.restlet.Component;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Restlet;
import org.restlet.data.MediaType;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.data.Status;
public class RestletRestService extends Restlet {
private ExecutorService executor = null;
public static void main(String[] args) throws Exception {
// Create the HTTP server and listen on port 8182
// Create a new Restlet component and add a HTTP server connector to it
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8080);
component.getDefaultHost().attach("/", new RestletRestService());
component.getServers().get(0).getContext().getParameters().add("maxTotalConnections", "-1");
component.getServers().get(0).getContext().getParameters().add("maxThreads", "100");
component.start();
}
public RestletRestService() {
executor = Executors.newFixedThreadPool(10);
}
@Override
public void handle(Request request, Response response) {
if (request.getMethod().equals(Method.POST)) {
try {
String str = request.getEntity().getText().toString();
System.out.println(" str " + str);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
response.setAutoCommitting(false);
final Response resp = response;
response.setAutoCommitting(false);
executor.execute(new Runnable() {
@Override
public void run() {
resp.setStatus(Status.SUCCESS_OK);
// resp.setEntity("OK Receive:)",
// MediaType.TEXT_PLAIN);
// resp.commit();
return;
}
});
}
}
}
...@@ -19,7 +19,7 @@ public class RestClientExample { ...@@ -19,7 +19,7 @@ public class RestClientExample {
obj.put("lon", "57.7361989724"); obj.put("lon", "57.7361989724");
obj.put("op_name", "bridgeNextClosure"); obj.put("op_name", "bridgeNextClosure");
String content = obj.toJSONString(); String content = obj.toJSONString();
String url = "http://localhost:1111"; String url = "http://localhost:8080";
Response resp = RestClientExample.post(url, content); Response resp = RestClientExample.post(url, content);
System.out.println(resp.getEntityAsText()); System.out.println(resp.getEntityAsText());
} }
......
...@@ -19,7 +19,7 @@ public class BrokerMqtt{ ...@@ -19,7 +19,7 @@ public class BrokerMqtt{
public BrokerMqtt() { public BrokerMqtt() {
this.broker = new BrokerService(); this.broker = new BrokerService();
this.port = 8891; this.port = 8891;
this.ip = MonitorConstant.M4; this.ip = MonitorConstant.M3;
} }
public BrokerMqtt(String ip, int port) { public BrokerMqtt(String ip, int port) {
......
...@@ -14,7 +14,7 @@ import eu.chorevolution.vsb.monitor.util.MonitorConstant; ...@@ -14,7 +14,7 @@ import eu.chorevolution.vsb.monitor.util.MonitorConstant;
public class MqttCallBack implements MqttCallback { public class MqttCallBack implements MqttCallback {
private MeasureAgent agent = new MeasureAgent("timestamp_6",System.currentTimeMillis(),MonitorConstant.M4,MonitorConstant.timestamp_6_port_listener); private MeasureAgent agent = new MeasureAgent("timestamp_6",System.currentTimeMillis(),MonitorConstant.M3,MonitorConstant.timestamp_6_port_listener);
private int countMessage = 0; private int countMessage = 0;
public void connectionLost(Throwable throwable) { public void connectionLost(Throwable throwable) {
......
...@@ -14,7 +14,7 @@ public class SubscriberMqtt { ...@@ -14,7 +14,7 @@ public class SubscriberMqtt {
MqttClient client; MqttClient client;
try { try {
client = new MqttClient("tcp://"+MonitorConstant.M4+":8891", MqttClient.generateClientId()); client = new MqttClient("tcp://"+MonitorConstant.M3+":8891", MqttClient.generateClientId());
client.setCallback( new MqttCallBack() ); client.setCallback( new MqttCallBack() );
client.connect(); client.connect();
client.subscribe("bridgeNextClosure"); client.subscribe("bridgeNextClosure");
......
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment