Commit 0e35d600 authored by Lukáš Marek's avatar Lukáš Marek

Added dispatchmp test

parent aadf2e96
......@@ -1711,6 +1711,7 @@ static void * jb_worker_loop(void * obj) {
// TODO ! const
process_buffs * pb = buffs_get(-12345);
// TODO perf improvement - you are copying the data twice
// copy data to the analysis buffer
buffer_fill(pb->analysis_buff, data, data_size);
......
......@@ -15,7 +15,7 @@ public class TargetClass {
ta[i] = new TargetClass();
}
System.out.println("Sent " + i + " events in "
System.out.println("Allocated " + i + " objects in "
+ (System.nanoTime() - start) / 1000000 + " ms");
}
}
package ch.usi.dag.disl.test.dispatchmp;
import ch.usi.dag.dislreserver.remoteanalysis.RemoteAnalysis;
import ch.usi.dag.dislreserver.shadow.ShadowObject;
// NOTE that this class is not static anymore
public class CodeExecuted extends RemoteAnalysis {
long startTime = 0;
long totalIntEvents = 0;
long totalObjEvents = 0;
long totalFreeEvents = 0;
public void intEvent(int number) {
if(startTime == 0) {
startTime = System.nanoTime();
}
++totalIntEvents;
if(totalIntEvents % 1000000 == 0) {
System.out.println("So far received "
+ totalIntEvents + " events...");
}
}
public void objectEvent(ShadowObject o) {
++totalObjEvents;
}
public void objectFree(ShadowObject netRef) {
++totalFreeEvents;
}
public void atExit() {
System.out.println("Total transport time is "
+ ((System.nanoTime() - startTime) / 1000000) + " ms");
System.out.println("Total number of int events: "
+ totalIntEvents);
System.out.println("Total number of object events: "
+ totalObjEvents);
System.out.println("Total number of free events: "
+ totalFreeEvents);
}
}
package ch.usi.dag.disl.test.dispatchmp;
import ch.usi.dag.dislre.REDispatch;
// Optimally, this class is automatically created on analysis machine
// and redefines during loading the CodeExecuted class on the client vm
// Even more optimally, this is automatically generated native class with same
// functionality
public class CodeExecutedRE {
private static short ieId = REDispatch.registerMethod(
"ch.usi.dag.disl.test.dispatch2.CodeExecuted.intEvent");
private static short oeId = REDispatch.registerMethod(
"ch.usi.dag.disl.test.dispatch2.CodeExecuted.objectEvent");
public static void intEvent(int num) {
REDispatch.analysisStart(ieId);
REDispatch.sendInt(num);
REDispatch.analysisEnd();
}
public static void objectEvent(Object o) {
REDispatch.analysisStart(oeId);
REDispatch.sendObject(o);
REDispatch.analysisEnd();
}
}
package ch.usi.dag.disl.test.dispatchmp;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BytecodeMarker;
public class DiSLClass {
@Before(marker = BytecodeMarker.class, args= "aastore", scope = "*TCTask.*")
public static void invokedInstr(DynamicContext dc) {
CodeExecutedRE.intEvent(dc.getStackValue(1, int.class));
}
@Before(marker = BytecodeMarker.class, args= "aastore", scope = "*TCTask.*")
public static void testing(DynamicContext dc) {
CodeExecutedRE.objectEvent(dc.getStackValue(0, Object.class));
}
}
Manifest-Version: 1.0
DiSL-Classes: ch.usi.dag.disl.test.dispatchmp.DiSLClass
\ No newline at end of file
package ch.usi.dag.disl.test.dispatchmp;
public class TargetClass {
protected static int THREAD_COUNT = 3;
public static class TCTask implements Runnable {
@Override
public void run() {
long start = System.nanoTime();
int COUNT = 10000000;
TargetClass ta[] = new TargetClass[COUNT];
int i;
for(i = 0; i < COUNT; ++i) {
ta[i] = new TargetClass();
}
System.out.println("Allocated " + i + " objects in "
+ (System.nanoTime() - start) / 1000000 + " ms");
}
}
public static void main(String[] args) throws InterruptedException {
TCTask task = new TCTask();
for(int i = 0; i < THREAD_COUNT; ++i) {
new Thread(task).start();
}
}
}
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