Commit 3357883c authored by Florian Fittkau's avatar Florian Fittkau

minor optimization

parent 69c482e7
......@@ -12,7 +12,9 @@ import org.aspectj.lang.Signature;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.YieldingWaitStrategy;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType;
import explorviz.hpc_monitoring.configuration.Configuration;
import explorviz.hpc_monitoring.configuration.ConfigurationFactory;
......@@ -35,7 +37,8 @@ public class MonitoringController {
final ExecutorService exec = Executors.newCachedThreadPool();
final Disruptor<ByteBufferEvent> disruptor = new Disruptor<ByteBufferEvent>(
ByteBufferEvent.EVENT_FACTORY, 256, exec);
ByteBufferEvent.EVENT_FACTORY, 32, exec, ProducerType.MULTI,
new YieldingWaitStrategy());
@SuppressWarnings("unchecked")
final EventHandler<ByteBufferEvent>[] eventHandlers = new EventHandler[1];
......@@ -58,9 +61,9 @@ public class MonitoringController {
public static void sendOutBuffer(final ByteBuffer buffer) {
buffer.flip();
final int max = buffer.limit();
final byte[] messages = new byte[max];
buffer.get(messages, 0, max);
putInRingbuffer(ByteBuffer.wrap(messages));
final ByteBuffer put = ByteBuffer.allocate(max).put(buffer);
put.flip();
putInRingbuffer(put);
buffer.clear();
}
......
......@@ -17,7 +17,7 @@ import explorviz.hpc_monitoring.threadlocal.ThreadLocalByteBuffer;
@Aspect
public abstract class AbstractAspect {
private static final int MESSAGE_BUFFER_SIZE = 131072;
private static final int MESSAGE_BUFFER_SIZE = 8000;
public static final ThreadLocalByteBuffer bufferStore = new ThreadLocalByteBuffer(
MESSAGE_BUFFER_SIZE); // TODO flush after 1 sec
......@@ -25,8 +25,7 @@ public abstract class AbstractAspect {
public abstract void monitoredOperation();
@Around("monitoredOperation()")
public Object operation(final ProceedingJoinPoint thisJoinPoint)
throws Throwable {
public Object operation(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
if (!MonitoringController.isMonitoringEnabled()) {
return thisJoinPoint.proceed();
}
......@@ -57,8 +56,7 @@ public abstract class AbstractAspect {
try {
retval = thisJoinPoint.proceed();
} catch (final Throwable th) {
if (AfterFailedOperationEvent.BYTE_LENGTH_WITH_CLAZZ_ID > buffer
.remaining()) {
if (AfterFailedOperationEvent.BYTE_LENGTH_WITH_CLAZZ_ID > buffer.remaining()) {
MonitoringController.sendOutBuffer(buffer);
}
......
package testpackage;
public class TestClass2 {
public void testMethod2() {
;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment