Commit 19007890 by Michael Schmid

found bug, MaiaBertogna Sim works now

parent 11c72917
......@@ -9,39 +9,16 @@ import mvd.jester.model.SystemSetup;
*/
public class App {
public static void main(String[] args) {
boolean runTests = false;
if (runTests) {
SystemSetup.Builder builder = new SystemSetup.Builder().setNumberOfProcessors(8);
SystemSetup.Builder builder = new SystemSetup.Builder().setNumberOfProcessors(8);
TestEnvironment te = new TestEnvironment(builder, 40000);
TestEnvironment te = new TestEnvironment(builder, 40000);
// te.registerTestInterface(SchmidMottok.class);
te.registerTestPair(mvd.jester.tests.MaiaBertogna.class,
mvd.jester.simulator.MaiaBertogna.class);
// te.registerTestInterface(SchmidMottok.class);
te.registerTestPair(mvd.jester.tests.MaiaBertogna.class,
mvd.jester.simulator.MaiaBertogna.class);
te.runTests();
} else {
File folder = new File("results");
for (File f : folder.listFiles()) {
SystemSetup systemSetup = SystemSetup.fromFile(f.toPath().toString());
mvd.jester.simulator.MaiaBertogna mb_sim =
new mvd.jester.simulator.MaiaBertogna(systemSetup);
mvd.jester.tests.MaiaBertogna mb_test =
new mvd.jester.tests.MaiaBertogna(systemSetup);
boolean simCheck = mb_sim.runSimulation();
boolean schedCheck = mb_test.runSchedulabilityCheck();
if (simCheck == false && schedCheck == true) {
System.out.println(f.getName());
}
}
}
te.runTests();
}
}
......@@ -90,16 +90,11 @@ public class TestEnvironment {
.compute(kv.getValue(), (k, v) -> (v == null) ? 1 : v + 1);
}
if (schedCheck == true && simCheck == false) {
boolean sched = kv.getKey().runSchedulabilityCheck();
boolean sim = kv.getValue().runSimulation();
if (sched == true && sim == false) {
try (PrintWriter out = new PrintWriter(
"results/manualCheck" + checkedTasksets + ".txt")) {
out.println(systemSetup);
} catch (Exception e) {
System.out.println("Ähm something went horribly wrong!");
}
try (PrintWriter out =
new PrintWriter("results/manualCheck" + checkedTasksets + ".txt")) {
out.println(systemSetup);
} catch (Exception e) {
System.out.println("Ähm something went horribly wrong!");
}
}
}
......
......@@ -19,7 +19,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
protected final SystemSetup systemSetup;
protected final Set<ProcessorContext> processors;
protected final SortedTaskContextSet readyTasks;
protected final long hyperPeriod;
protected long hyperPeriod;
AbstractSimulator(SystemSetup systemSetup) {
this.systemSetup = systemSetup;
......@@ -32,6 +32,13 @@ public abstract class AbstractSimulator implements SimulatorInterface {
// LongMath.pow(systemSetup.getTasks().last().getPeriod(), 2);
}
protected void init() {
this.readyTasks.clear();
for (ProcessorContext p : processors) {
p.setJob(null);
}
this.hyperPeriod = systemSetup.getTasks().last().getPeriod() * 10;
}
protected boolean releaseTasks(long timeStep) {
for (Task t : systemSetup.getTasks()) {
......
......@@ -18,7 +18,7 @@ public class MaiaBertogna extends AbstractSimulator {
@Override
public boolean runSimulation() {
readyTasks.clear();
init();
for (int t = 0; t < hyperPeriod; ++t) {
if (!releaseTasks(t)) {
return false;
......
......@@ -2,6 +2,7 @@ package mvd.jester.tests;
import java.util.HashMap;
import java.util.Map;
import mvd.jester.model.SystemSetup;
import mvd.jester.model.Task;
/**
......@@ -10,8 +11,10 @@ import mvd.jester.model.Task;
public abstract class AbstractTest implements TestInterface {
protected final Map<Task, Long> responseTimes;
protected final SystemSetup systemSetup;
public AbstractTest() {
public AbstractTest(SystemSetup systemSetup) {
this.systemSetup = systemSetup;
this.responseTimes = new HashMap<Task, Long>();
}
}
......@@ -12,10 +12,8 @@ import mvd.jester.model.SystemSetup;
*/
public class MaiaBertogna extends AbstractTest {
private final SystemSetup systemSetup;
public MaiaBertogna(SystemSetup systemSetup) {
this.systemSetup = systemSetup;
super(systemSetup);
}
@Override
......
......@@ -12,10 +12,8 @@ import mvd.jester.model.SystemSetup;
*/
public class SchmidMottok extends AbstractTest {
private final SystemSetup systemSetup;
public SchmidMottok(SystemSetup systemSetup) {
this.systemSetup = systemSetup;
super(systemSetup);
}
@Override
......
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 sign in to comment