static void testJNI() throws Exception {
SocketUDT socket = new SocketUDT(TypeUDT.DATAGRAM);
long nanos;
StopWatch timer = new StopWatch();
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testEmptyCall0();
}
timer.stop();
nanos = timer.nanoTime() / COUNT;
log.info("empty call; nanos={}", nanos);
timer.start();
for (int k = 0; k < COUNT * 10; k++) {
int[] array = socket.testMakeArray0(SIZE);
}
timer.stop();
nanos = timer.nanoTime() / COUNT / 10;
log.info("make arrray; nanos={}", nanos);
int[] arrayInt = new int[SIZE];
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testGetSetArray0(arrayInt, true);
}
timer.stop();
nanos = timer.nanoTime() / COUNT;
log.info("get/set/update array; nanos={}", nanos);
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testGetSetArray0(arrayInt, false);
}
timer.stop();
nanos = timer.nanoTime() / COUNT;
log.info("get/set/abort array; nanos={}", nanos);
Object[] array = new Object[SIZE];
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testIterateArray0(array);
}
timer.stop();
nanos = timer.nanoTime() / COUNT / SIZE;
log.info("iterate object array; nanos={}", nanos);
//
Set<Object> set = new HashSet<Object>();
for (int k = 0; k < SIZE; k++) {
set.add(k);
}
timer.start();
for (int k = 0; k < COUNT / 10; k++) {
socket.testIterateSet0(set);
}
timer.stop();
nanos = timer.nanoTime() / COUNT / SIZE * 10;
log.info("iterate object set; nanos={}", nanos);
//
final int FILL_SIZE = 16;
byte[] fillArray = new byte[FILL_SIZE];
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testFillArray0(fillArray);
}
timer.stop();
nanos = timer.nanoTime() / COUNT;
log.info("fillArray; nanos={}", nanos);
ByteBuffer fillBuffer = ByteBuffer.allocateDirect(FILL_SIZE);
timer.start();
for (int k = 0; k < COUNT; k++) {
socket.testFillBuffer0(fillBuffer);
}
timer.stop();
nanos = timer.nanoTime() / COUNT;
log.info("fillBuffer; nanos={}", nanos);
}