Commit 79325cf3 authored by Lukáš Marek's avatar Lukáš Marek

Included time stats for DiSLServer

parent c8df0858
......@@ -8,6 +8,7 @@
# -Ddislserver.instrumented="path" \
# -Ddislserver.uninstrumented="path" \
# -Ddislserver.port="portNum" \
# -Ddislserver.timestat=true \
java -Ddislserver.port="1234" \
......
......@@ -40,6 +40,12 @@ public abstract class CodeMerger {
return instrumentedCN;
}
// TODO jb ! add splitting for to long methods
// - splitting is off by default
// - measure the length of the resulting method and split if necessary
// - ignore clinit - output warning
// - output warning if splitted is to large and ignore
for (MethodNode instrMN : instrumentedCN.methods) {
// We will construct the merged method node in the instrumented
......
......@@ -3,6 +3,7 @@ package ch.usi.dag.dislserver;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import ch.usi.dag.disl.DiSL;
import ch.usi.dag.disl.exception.DiSLException;
......@@ -15,8 +16,13 @@ public abstract class DiSLServer {
private static final String PROP_PORT = "dislserver.port";
private static final int DEFAULT_PORT = 11217;
private static final int port = Integer.getInteger(PROP_PORT, DEFAULT_PORT);
private static final String PROP_TIME_STAT = "dislserver.timestat";
private static final boolean timeStat = Boolean.getBoolean(PROP_TIME_STAT);
private static final AtomicInteger aliveWorkers = new AtomicInteger();
private static final AtomicLong instrumentationTime = new AtomicLong();
private static DiSL disl;
public static void main(String args[]) {
......@@ -77,12 +83,19 @@ public abstract class DiSLServer {
e.printStackTrace();
}
public static void workerDone() {
public static void workerDone(long instrTime) {
instrumentationTime.addAndGet(instrTime);
if (aliveWorkers.decrementAndGet() == 0) {
disl.terminate();
if (timeStat) {
System.out.println("Instrumentation took " +
instrumentationTime.get() / 1000000 + " milliseconds");
}
if (debug) {
System.out.println("Instrumentation server is shutting down");
}
......
......@@ -6,6 +6,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.concurrent.atomic.AtomicLong;
import ch.usi.dag.disl.DiSL;
import ch.usi.dag.disl.exception.DiSLException;
......@@ -26,6 +27,8 @@ public class Worker extends Thread {
private final NetClassReader sc;
private final DiSL disl;
private final AtomicLong instrumentationTime = new AtomicLong();
Worker(NetClassReader sc, DiSL disl) {
this.sc = sc;
......@@ -44,7 +47,7 @@ public class Worker extends Thread {
DiSLServer.reportError(e);
}
finally {
DiSLServer.workerDone();
DiSLServer.workerDone(instrumentationTime.get());
}
}
......@@ -65,10 +68,12 @@ public class Worker extends Thread {
try {
// TODO jb - weave time stats
long startTime = System.nanoTime();
instrClass = instrument(new String(cab.getName()),
cab.getCode());
instrumentationTime.addAndGet(System.nanoTime() - startTime);
}
catch (Exception e) {
......
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