Commit 757d1293 authored by Lukáš Marek's avatar Lukáš Marek

increased heap for ShadovVM jvm

improved debugging support and added debug and debugfull make options
fixed nasty bug with gc getting stuck using utility buffers
replaced normal buffers with utility buffers where applicable
decreased number of normal buffers but increased size
sending thread is starting at the beginning and it is not attached to the jvm anymore
free events are now buffered and send in correct order
introduced thread end messages
messages registering analysis method are sending the method name string directly instead of string object
fixed dispatchmp test
parent 22d5a20d
......@@ -15,6 +15,7 @@ shift
# start server
java $* \
-Xms1G -Xmx2G \
-cp ${INSTR_LIB}:${DISL_LIB_P}/dislre-server.jar \
ch.usi.dag.dislreserver.DiSLREServer \
&
......
......@@ -38,6 +38,10 @@ ifneq ($(DEBUG),)
CFLAGS += -DDEBUG -g3
endif
ifneq ($(DEBUGFULL),)
CFLAGS += -DDEBUG -DDEBUGANL -g3
endif
build: $(LIBRARY)
cp $(LIBRARY) $(BUILDDIR)
......@@ -52,4 +56,7 @@ clean:
debug:
$(MAKE) DEBUG=TRUE
debugfull:
$(MAKE) DEBUGFULL=TRUE
all: build
\ No newline at end of file
This diff is collapsed.
......@@ -14,11 +14,13 @@ static const jbyte MSG_OBJ_FREE = 2;
static const jbyte MSG_NEW_CLASS = 3;
// sending class info
static const jbyte MSG_CLASS_INFO = 4;
// sending new string
// sending string info
static const jbyte MSG_STRING_INFO = 5;
// sending registration for analysis method
static const jbyte MSG_REG_ANALYSIS = 6;
// sending thread info
static const jbyte MSG_THREAD_INFO = 7;
// sending thread end message
static const jbyte MSG_THREAD_END = 8;
#endif /* _MESSAGETYPE_H */
......@@ -189,6 +189,9 @@ public final class AnalysisHandler implements RequestHandler {
));
}
public void threadEnded(long threadId) {
// TODO !
}
public void awaitProcessing () {
dispatcher.awaitProcessing ();
......
......@@ -11,7 +11,6 @@ import java.util.Set;
import ch.usi.dag.dislreserver.exception.DiSLREServerException;
import ch.usi.dag.dislreserver.exception.DiSLREServerFatalException;
import ch.usi.dag.dislreserver.remoteanalysis.RemoteAnalysis;
import ch.usi.dag.dislreserver.shadow.ShadowString;
public final class AnalysisResolver {
private static final String METHOD_DELIM = ".";
......@@ -50,11 +49,9 @@ public final class AnalysisResolver {
//
private static AnalysisMethodHolder resolveMethod (
ShadowString methodString
private static AnalysisMethodHolder resolveMethod (String methodStr
) throws DiSLREServerException {
try {
String methodStr = methodString.toString();
int classNameEnd = methodStr.lastIndexOf (METHOD_DELIM);
// without METHOD_DELIM
......@@ -134,7 +131,7 @@ public final class AnalysisResolver {
public static void registerMethodId (
final short methodId, ShadowString methodString
final short methodId, String methodString
) throws DiSLREServerException {
methodMap.put(methodId, resolveMethod(methodString));
}
......
......@@ -18,18 +18,24 @@ public class ObjectFreeHandler implements RequestHandler {
throws DiSLREServerException {
try {
long net_ref = is.readLong();
ShadowObject obj = ShadowObjectTable.get(net_ref);
Set<RemoteAnalysis> raSet = AnalysisResolver.getAllAnalyses();
// TODO ! free events should be sent to analysis that sees the shadow object
for (RemoteAnalysis ra : raSet) {
ra.objectFree(obj);
int freeCount = is.readInt();
for(int i = 0; i < freeCount; ++i) {
long net_ref = is.readLong();
ShadowObject obj = ShadowObjectTable.get(net_ref);
Set<RemoteAnalysis> raSet = AnalysisResolver.getAllAnalyses();
// TODO ! free events should be sent to analysis that sees the shadow object
for (RemoteAnalysis ra : raSet) {
ra.objectFree(obj);
}
ShadowObjectTable.freeShadowObject(net_ref, obj);
}
ShadowObjectTable.freeShadowObject(net_ref, obj);
} catch (IOException e) {
throw new DiSLREServerException(e);
}
......
......@@ -7,8 +7,6 @@ import java.io.IOException;
import ch.usi.dag.dislreserver.exception.DiSLREServerException;
import ch.usi.dag.dislreserver.msg.analyze.AnalysisResolver;
import ch.usi.dag.dislreserver.reqdispatch.RequestHandler;
import ch.usi.dag.dislreserver.shadow.ShadowObjectTable;
import ch.usi.dag.dislreserver.shadow.ShadowString;
public final class RegAnalysisHandler implements RequestHandler {
......@@ -16,8 +14,7 @@ public final class RegAnalysisHandler implements RequestHandler {
final boolean debug) throws DiSLREServerException {
try {
final short methodId = is.readShort();
final long methodStringID = is.readLong();
ShadowString methodString = (ShadowString) ShadowObjectTable.get(methodStringID);
String methodString = is.readUTF();
// register method
AnalysisResolver.registerMethodId(methodId, methodString);
......
package ch.usi.dag.dislreserver.msg.threadend;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import ch.usi.dag.dislreserver.exception.DiSLREServerException;
import ch.usi.dag.dislreserver.msg.analyze.AnalysisHandler;
import ch.usi.dag.dislreserver.reqdispatch.RequestHandler;
public class ThreadEndHandler implements RequestHandler {
final AnalysisHandler analysisHandler;
public ThreadEndHandler(AnalysisHandler anlHndl) {
analysisHandler = anlHndl;
}
public void handle(DataInputStream is, DataOutputStream os, boolean debug)
throws DiSLREServerException {
try {
long threadId = is.readLong();
// announce thread end to the analysis handler
analysisHandler.threadEnded(threadId);
} catch (IOException e) {
throw new DiSLREServerException(e);
}
}
public void awaitProcessing() {
}
public void exit() {
}
}
......@@ -17,6 +17,7 @@ import ch.usi.dag.dislreserver.msg.newclass.NewClassHandler;
import ch.usi.dag.dislreserver.msg.objfree.ObjectFreeHandler;
import ch.usi.dag.dislreserver.msg.reganalysis.RegAnalysisHandler;
import ch.usi.dag.dislreserver.msg.stringinfo.StringInfoHandler;
import ch.usi.dag.dislreserver.msg.threadend.ThreadEndHandler;
import ch.usi.dag.dislreserver.msg.threadinfo.ThreadInfoHandler;
......@@ -35,6 +36,7 @@ public final class RequestDispatcher {
private static final byte __REQUEST_ID_STRING_INFO__ = 5;
private static final byte __REQUEST_ID_REGISTER_ANALYSIS__ = 6;
private static final byte __REQUEST_ID_THREAD_INFO__ = 7;
private static final byte __REQUEST_ID_THREAD_END__ = 8;
//
......@@ -50,6 +52,7 @@ public final class RequestDispatcher {
//
final Map <Byte, RequestHandler> requestMap = new HashMap <Byte, RequestHandler> ();
requestMap.put (__REQUEST_ID_CLOSE__, new CloseHandler ());
AnalysisHandler anlHndl = new AnalysisHandler ();
requestMap.put (__REQUEST_ID_INVOKE_ANALYSIS__, new AnalysisHandler ());
requestMap.put (__REQUEST_ID_OBJECT_FREE__, new ObjectFreeHandler ());
requestMap.put (__REQUEST_ID_NEW_CLASS__, new NewClassHandler ());
......@@ -57,6 +60,7 @@ public final class RequestDispatcher {
requestMap.put (__REQUEST_ID_STRING_INFO__, new StringInfoHandler ());
requestMap.put (__REQUEST_ID_REGISTER_ANALYSIS__, new RegAnalysisHandler ());
requestMap.put (__REQUEST_ID_THREAD_INFO__, new ThreadInfoHandler());
requestMap.put (__REQUEST_ID_THREAD_END__, new ThreadEndHandler(anlHndl));
__handlers = Collections.unmodifiableCollection (requestMap.values ());
__dispatchTable = __createDispatchTable (requestMap);
......
package ch.usi.dag.disl.test.dispatchmp;
import java.util.concurrent.atomic.AtomicLong;
import ch.usi.dag.dislreserver.remoteanalysis.RemoteAnalysis;
import ch.usi.dag.dislreserver.shadow.ShadowObject;
......@@ -8,9 +10,9 @@ public class CodeExecuted extends RemoteAnalysis {
long startTime = 0;
long totalIntEvents = 0;
long totalObjEvents = 0;
long totalFreeEvents = 0;
AtomicLong totalIntEvents = new AtomicLong();
AtomicLong totalObjEvents = new AtomicLong();
AtomicLong totalFreeEvents = new AtomicLong();
public void intEvent(int number) {
......@@ -18,9 +20,7 @@ public class CodeExecuted extends RemoteAnalysis {
startTime = System.nanoTime();
}
++totalIntEvents;
if(totalIntEvents % 1000000 == 0) {
if(totalIntEvents.incrementAndGet() % 1000000 == 0) {
System.out.println("So far received "
+ totalIntEvents + " events...");
}
......@@ -28,11 +28,11 @@ public class CodeExecuted extends RemoteAnalysis {
public void objectEvent(ShadowObject o) {
++totalObjEvents;
totalObjEvents.incrementAndGet();
}
public void objectFree(ShadowObject netRef) {
++totalFreeEvents;
totalFreeEvents.incrementAndGet();
}
public void atExit() {
......
......@@ -10,10 +10,10 @@ import ch.usi.dag.dislre.REDispatch;
public class CodeExecutedRE {
private static short ieId = REDispatch.registerMethod(
"ch.usi.dag.disl.test.dispatch2.CodeExecuted.intEvent");
"ch.usi.dag.disl.test.dispatchmp.CodeExecuted.intEvent");
private static short oeId = REDispatch.registerMethod(
"ch.usi.dag.disl.test.dispatch2.CodeExecuted.objectEvent");
"ch.usi.dag.disl.test.dispatchmp.CodeExecuted.objectEvent");
public static void intEvent(int num) {
......
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