Commit 19007890 by Michael Schmid

found bug, MaiaBertogna Sim works now

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