use of org.jpos.util.Profiler in project jPOS by jpos.
the class JESpaceTestCase method testMultiKeyLoad.
public void testMultiKeyLoad() throws Exception {
String s = "The quick brown fox jumped over the lazy dog";
Profiler prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
sp.out("testMultiKeyLoad_Key" + Integer.toString(i), s);
if (i % 100 == 0)
prof.checkPoint("out " + i);
}
// prof.dump (System.err, "MultiKeyLoad out >");
prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
assertTrue(s.equals(sp.in("testMultiKeyLoad_Key" + Integer.toString(i))));
if (i % 100 == 0)
prof.checkPoint("in " + i);
}
// prof.dump (System.err, "MultiKeyLoad in >");
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class JESpaceTestCase method testSingleKeyLoad.
public void testSingleKeyLoad() throws Exception {
String s = "The quick brown fox jumped over the lazy dog";
String k = "testSingleKeyLoad_Key";
Profiler prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
sp.out(k, s);
if (i % 100 == 0)
prof.checkPoint("out " + i);
}
// prof.dump (System.err, "SingleKeyLoad out >");
prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
assertTrue(s.equals(sp.in(k)));
if (i % 100 == 0)
prof.checkPoint("in " + i);
}
// prof.dump (System.err, "SingleKeyLoad in >");
assertTrue(sp.rdp(k) == null);
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class PackagerTestCase method testPerformance.
public void testPerformance() throws Exception {
final int COUNT = 100000;
ISOPackager p = new GenericPackager("src/main/resources/packager/iso87binary.xml");
ISOMsg baseMsg = getMsg("ISO87");
System.out.println("\n--- pack/unpack performance test ---\n");
Profiler prof = new Profiler();
TPS tps = new TPS(true);
for (int i = 0; i < COUNT; i++) {
pack(baseMsg, p);
tps.tick();
}
prof.checkPoint("PACK " + tps.toString());
byte[] buf = baseMsg.pack();
tps = new TPS(true);
for (int i = 0; i < COUNT; i++) {
unpack(buf, p);
tps.tick();
}
prof.checkPoint("UNPACK " + tps.toString());
tps = new TPS(true);
for (int i = 0; i < COUNT; i++) {
pack(baseMsg, p);
unpack(buf, p);
tps.tick();
}
prof.checkPoint("PACK/UNPACK " + tps.toString());
tps = new TPS(true);
for (int i = 0; i < COUNT; i++) {
updatePackAndUnpack(baseMsg, p);
tps.tick();
}
prof.checkPoint("UPDATE/PACK/UNPACK " + tps.toString());
prof.dump(System.out, "");
System.out.println("");
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class LOGGER_BENCHMARK method exec.
public void exec(CLIContext ctx, String[] args) throws Exception {
if (args.length != 3) {
ctx.println(String.format("Usage: %s threads messages", args[0]));
return;
}
int threadCount = Integer.parseInt(args[1]);
final int numMessages = Integer.parseInt(args[2]);
final Profiler p = new Profiler();
final CountDownLatch done = new CountDownLatch(threadCount);
for (int i = 0; i < threadCount; i++) {
final String name = "Thread " + i;
new Thread() {
public void run() {
for (int i = 0; i < numMessages; i++) {
LogEvent ev = new LogEvent();
ev.addMessage(name + " " + i);
Logger.log(ev);
}
p.checkPoint(name);
done.countDown();
}
}.start();
}
done.await();
p.dump(System.out, "");
}
Aggregations