OW2 Consortium joram

Compare Revisions

Ignore whitespace Rev 6458 → Rev 6459

/trunk/joram/samples/src/joram/rest/PerfConsumer.java
31,6 → 31,7
}
}
 
// Test with JSon message
public void run() {
RestConsumer cons = new RestConsumer("http://localhost:8989/joram/", "queue");
 
74,4 → 75,32
 
cons.close();
}
 
// Test with simple String message
public void run2() {
RestConsumer cons = new RestConsumer("http://localhost:8989/joram/", "queue");
 
for (int i=0; i<(Round*NbMsgPerRound); i++) {
String msg = cons.receiveStringMsg();
 
last = System.currentTimeMillis();
// int index = Integer.parseInt((String) ((ArrayList) props.get("index")).get(0));
if (i == 0) start = t1 = last;
 
// long time = Long.parseLong((String) ((ArrayList) props.get("time")).get(0));
// long dt = (last - time);
// travel += dt;
 
if ((i%NbMsgPerRound) == (NbMsgPerRound -1)) {
long x = (NbMsgPerRound * 1000L) / (last - t1);
t1 = last;
System.out.println("#" + ((i+1)/NbMsgPerRound) + " x " + NbMsgPerRound + " msg -> " + x + " msg/s " + (travel/i));
}
}
 
long x = (Round * NbMsgPerRound * 1000L) / (last - start);
System.out.println("Moy -> " + x + " msg/s ");
 
cons.close();
}
}
/trunk/joram/samples/src/joram/rest/PerfProducer.java
37,6 → 37,7
}
}
 
// Test with JSon message
public void run() {
RestProducer prod = new RestProducer("http://localhost:8989/joram/", "queue");
 
89,4 → 90,46
// close the producer
prod.close();
}
 
// Test with simple String message
public void run2() {
RestProducer prod = new RestProducer("http://localhost:8989/joram/", "queue");
 
StringBuffer strbuf = new StringBuffer();
for (int i = 0; i< MsgSize; i++)
strbuf.append('0');
String content = strbuf.toString();
long dtx = 0;
long start = System.currentTimeMillis();
 
for (int i=0; i<(Round*NbMsgPerRound); i++) {
prod.sendStringMessage(content);
if ((i%NbMsgPerRound) == (NbMsgPerRound-1)) {
long dtx1 = (i * 1000L) / mps;
long dtx2 = System.currentTimeMillis() - start;
if (dtx1 > (dtx2 + 20)) {
dtx += (dtx1 - dtx2);
try {
Thread.sleep(dtx1 - dtx2);
} catch (InterruptedException exc) { }
}
if (dtx2 > 0)
System.out.println("sent=" + i + ", mps=" + ((((long) i) * 1000L)/dtx2));
else
System.out.println("sent=" + i);
}
}
long end = System.currentTimeMillis();
long dt = end - start;
 
System.out.println("----------------------------------------------------");
System.out.println("| sender dt=" + ((dt *1000L)/(Round*NbMsgPerRound)) + "us -> " +
((1000L * (Round*NbMsgPerRound)) / (dt)) + "msg/s");
System.out.println("| sender wait=" + dtx + "ms");
 
// close the producer
prod.close();
}
}