diff --git a/.classpath b/.classpath
index f0257c5..67f3b6a 100644
--- a/.classpath
+++ b/.classpath
@@ -31,6 +31,12 @@
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index f65c9bb..b7c2801 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,11 @@
+ org.apache.commons
+ commons-math3
+ 3.2
+
+
org.junit.jupiter
junit-jupiter-api
5.4.0
diff --git a/src/main/java/mvd/jester/App.java b/src/main/java/mvd/jester/App.java
index e648983..ef9ab62 100644
--- a/src/main/java/mvd/jester/App.java
+++ b/src/main/java/mvd/jester/App.java
@@ -12,16 +12,16 @@ import mvd.jester.priority.RateMonotonic;
public class App {
public static void main(String[] args) {
SystemSetup.Builder builder = new SystemSetup.Builder().setNumberOfProcessors(8);
- TestEnvironment te = new TestEnvironment(builder, 30000);
+ TestEnvironment te = new TestEnvironment(builder, 40000);
te.registerSchedulingAlgorithm(new RateMonotonic());
- te.registerSchedulingAlgorithm(new EarliestDeadlineFirst());
+ // te.registerSchedulingAlgorithm(new EarliestDeadlineFirst());
- // te.registerTest(mvd.jester.tests.SchmidMottok.class);
- // te.registerTest(mvd.jester.tests.MaiaBertogna.class);
+ te.registerTest(mvd.jester.tests.SchmidMottok.class);
+ te.registerTest(mvd.jester.tests.MaiaBertogna.class);
- te.registerSimulator(mvd.jester.simulator.MaiaBertogna.class);
- te.registerSimulator(mvd.jester.simulator.SchmidMottok.class);
+ // te.registerSimulator(mvd.jester.simulator.MaiaBertogna.class);
+ // te.registerSimulator(mvd.jester.simulator.SchmidMottok.class);
te.runTests();
diff --git a/src/main/java/mvd/jester/ResultCollector.java b/src/main/java/mvd/jester/ResultCollector.java
index 6e36282..aad0549 100644
--- a/src/main/java/mvd/jester/ResultCollector.java
+++ b/src/main/java/mvd/jester/ResultCollector.java
@@ -8,6 +8,7 @@ import java.util.Optional;
import java.util.Set;
import com.google.common.collect.Table;
import com.google.common.math.Stats;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import mvd.jester.info.SchedulingInfo;
import mvd.jester.info.TerminationInfo;
import mvd.jester.simulator.AbstractSimulator;
@@ -36,22 +37,52 @@ public class ResultCollector {
public void logAll() {
if (!testResults.isEmpty()) {
logFeasibility(testResults, "test");
- logTardinessStatistics(simulatorResults, "test");
+ logFeasibilityRatio(testResults, "test");
+ logTardinessStatistics(testResults, "test");
logFailedTardiness(testResults, "test");
}
if (!simulatorResults.isEmpty()) {
logFeasibility(simulatorResults, "sim");
+ logFeasibilityRatio(simulatorResults, "sim");
logTardinessStatistics(simulatorResults, "sim");
logFailedTardiness(simulatorResults, "sim");
}
}
+ public void logFeasibilityRatio(
+ Table, Set> results, String type) {
+ LocalTime date = LocalTime.now();
+ Logger log = new Logger("./results/feasibility_ratio_" + type + "_" + numberOfProcessors
+ + "_" + date.getHour() + ":" + date.getMinute() + ".txt");
+ String firstLine = new String("Utilization");
+
+ if (!results.isEmpty()) {
+ for (Pair pair : results.columnKeySet()) {
+ firstLine = firstLine + "\t" + pair.getName();
+ }
+
+ log.log(firstLine);
+
+ for (Long util : totalNumberOfTasksets.keySet()) {
+ String line = String.valueOf((double) util / 10);
+ for (Pair pair : results.columnKeySet()) {
+ long feasibleTasksets = results.get(util, pair).stream()
+ .filter(s -> s.checkTasksetFeasible()).count();
+ line += "\t" + ((double) feasibleTasksets / totalNumberOfTasksets.get(util));
+ }
+ log.log(line);
+ }
+ }
+
+ log.finalize();
+ }
+
public void logFeasibility(
Table, Set> results, String type) {
LocalTime date = LocalTime.now();
- Logger log = new Logger("./results/results_" + type + "_" + numberOfProcessors + "_"
+ Logger log = new Logger("./results/feasibility_" + type + "_" + numberOfProcessors + "_"
+ date.getHour() + ":" + date.getMinute() + ".txt");
- String firstLine = new String("Utilization\tTotal");
+ String firstLine = new String("Utilization");
if (!results.isEmpty()) {
for (Pair pair : results.columnKeySet()) {
@@ -61,8 +92,7 @@ public class ResultCollector {
log.log(firstLine);
for (Long util : totalNumberOfTasksets.keySet()) {
- String line =
- String.valueOf((double) util / 10) + "\t" + totalNumberOfTasksets.get(util);
+ String line = String.valueOf((double) util / 10);
for (Pair pair : results.columnKeySet()) {
long feasibleTasksets = results.get(util, pair).stream()
.filter(s -> s.checkTasksetFeasible()).count();
@@ -81,7 +111,7 @@ public class ResultCollector {
LocalTime date = LocalTime.now();
Logger log = new Logger("./results/failed_tardiness_" + type + "_" + numberOfProcessors
+ "_" + date.getHour() + ":" + date.getMinute() + ".txt");
- String firstLine = new String("Utilization\tTotal");
+ String firstLine = new String("Utilization");
if (!results.isEmpty()) {
for (Pair pair : results.columnKeySet()) {
@@ -91,8 +121,7 @@ public class ResultCollector {
log.log(firstLine);
for (Long kv : totalNumberOfTasksets.keySet()) {
- String line =
- String.valueOf((double) kv / 10) + "\t" + totalNumberOfTasksets.get(kv);
+ String line = String.valueOf((double) kv / 10);
for (Pair pair : results.columnKeySet()) {
Set simulationInfos = results.get(kv, pair);
List values = new ArrayList<>();
@@ -122,7 +151,7 @@ public class ResultCollector {
LocalTime date = LocalTime.now();
Logger log = new Logger("./results/statistics_tardiness_" + type + "_" + numberOfProcessors
+ "_" + date.getHour() + ":" + date.getMinute() + ".txt");
- String firstLine = new String("Utilization\tTotal");
+ String firstLine = new String("Utilization");
if (!results.isEmpty()) {
for (Pair pair : results.columnKeySet()) {
@@ -132,23 +161,18 @@ public class ResultCollector {
log.log(firstLine);
for (Long kv : totalNumberOfTasksets.keySet()) {
- String line =
- String.valueOf((double) kv / 10) + "\t" + totalNumberOfTasksets.get(kv);
+ String line = String.valueOf((double) kv / 10);
for (Pair pair : results.columnKeySet()) {
Set simulationInfos = results.get(kv, pair);
- List values = new ArrayList<>();
+ DescriptiveStatistics stats = new DescriptiveStatistics();
for (SchedulingInfo s : simulationInfos) {
for (TerminationInfo t : s.getTerminationInfos()) {
- values.add(t.getLateness());
+ stats.addValue(t.getLateness());
}
}
- double meanTardiness = 0;
- if (!values.isEmpty()) {
- meanTardiness = Stats.meanOf(values.iterator());
- }
- line += "\t" + meanTardiness;
+ line += "\t" + stats.getMean();
}
log.log(line);
}
diff --git a/src/main/java/mvd/jester/info/SchedulingInfo.java b/src/main/java/mvd/jester/info/SchedulingInfo.java
index 99e3d3e..bd7c772 100644
--- a/src/main/java/mvd/jester/info/SchedulingInfo.java
+++ b/src/main/java/mvd/jester/info/SchedulingInfo.java
@@ -19,6 +19,8 @@ public class SchedulingInfo {
public SchedulingInfo(Set terminationInfos) {
this.terminationInfos = terminationInfos;
+ failedTerminationInfo =
+ terminationInfos.stream().filter(t -> t.getLateness() > 0).findFirst();
}
public boolean checkTasksetFeasible() {
diff --git a/src/main/java/mvd/jester/model/SystemSetup.java b/src/main/java/mvd/jester/model/SystemSetup.java
index c227375..bbf4eae 100644
--- a/src/main/java/mvd/jester/model/SystemSetup.java
+++ b/src/main/java/mvd/jester/model/SystemSetup.java
@@ -101,8 +101,11 @@ public class SystemSetup {
}
- private long randomTaskPeriod() {
- return ThreadLocalRandom.current().nextLong(minPeriod, maxPeriod);
+ private long randomTaskPeriod(boolean serial) {
+ if (serial)
+ return ThreadLocalRandom.current().nextLong(minPeriod, maxPeriod);
+ else
+ return ThreadLocalRandom.current().nextLong(minPeriod, maxPeriod * 10);
}
private long randomTaskRatio() {
@@ -126,20 +129,13 @@ public class SystemSetup {
private Task generateTask() {
boolean serial = randomTaskRatio() > this.ratio;
- long period = randomTaskPeriod();
- long numberOfSegments = 1;
- Set segments = new LinkedHashSet();
- if (!serial) {
- numberOfSegments = randomNumberOfSegments();
- } else {
- numberOfSegments = 1;
- }
+ long period = randomTaskPeriod(serial);
+ long numberOfSegments = serial ? 1 : randomNumberOfSegments();
long parallelNumberOfJobs = serial ? 1 : randomNumberOfJobs();
+ Set segments = new LinkedHashSet();
+
for (int i = 0; i < numberOfSegments; ++i) {
- long numberOfJobs = 1;
- if (i % 2 == 1) {
- numberOfJobs = parallelNumberOfJobs;
- }
+ long numberOfJobs = i % 2 == 1 ? parallelNumberOfJobs : 1;
long wcet = randomWcet(period, numberOfSegments);
segments.add(new Segment(wcet, numberOfJobs));
}
@@ -147,10 +143,9 @@ public class SystemSetup {
}
private Set generateTaskSet() {
- // SortedTaskSet taskSet = new SortedTaskSet(priorityManager);
Set taskSet = new HashSet<>();
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < numberOfProcessors; ++i) {
Task task = generateTask();
taskSet.add(task);
}