use of org.jpos.util.Profiler in project jPOS by jpos.
the class JDBMSpaceTestCase method testNoAutoCommit.
@Test
public void testNoAutoCommit() throws Exception {
String s = "The quick brown fox jumped over the lazy dog";
Profiler prof = new Profiler();
synchronized (sp) {
sp.setAutoCommit(false);
for (int i = 0; i < COUNT; i++) {
sp.out("testNoAutoCommit_Key" + Integer.toString(i), s);
if (i % 100 == 0)
prof.checkPoint("out " + i);
}
prof.checkPoint("pre-commit");
sp.commit();
sp.setAutoCommit(true);
prof.checkPoint("commit");
}
// prof.dump (System.err, "NoAutoCommit out >");
prof = new Profiler();
synchronized (sp) {
sp.setAutoCommit(false);
for (int i = 0; i < COUNT; i++) {
assertTrue(s.equals(sp.in("testNoAutoCommit_Key" + Integer.toString(i))));
if (i % 100 == 0)
prof.checkPoint("in " + i);
}
prof.checkPoint("pre-commit");
sp.commit();
sp.setAutoCommit(true);
prof.checkPoint("commit");
}
// prof.dump (System.err, "NoAutoCommit in >");
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class TSpaceTestCase method testMultiKeyLoad.
@Test
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, 60000);
}
// 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))));
}
// prof.dump (System.err, "MultiKeyLoad in >");
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class TSpaceTestCase method testSingleKeyLoad.
@Test
public void testSingleKeyLoad() throws Exception {
String s = "The quick brown fox jumped over the lazy dog";
String k = "testSingleKeyLoad_SingleKey";
Profiler prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
sp.out(k, s, 60000);
}
// prof.dump (System.err, "SingleKeyLoad out >");
prof = new Profiler();
for (int i = 0; i < COUNT; i++) {
assertTrue(s.equals(sp.in(k)));
}
// prof.dump (System.err, "SingleKeyLoad in >");
assertNull(sp.rdp(k));
}
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, "");
}
use of org.jpos.util.Profiler in project jPOS by jpos.
the class JDBMSpaceTestCase method testMultiKeyLoad.
@Test
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 >");
}
Aggregations