Commit ece7d61d by Michael Schmid

Minor changes

parent d255848d
......@@ -102,7 +102,8 @@ public class SystemSetup {
public static class Builder {
private long numberOfProcessors = 4;
private long minPeriod = 100;
private long maxPeriod = 1000;
private long maxSequentialPeriod = 1000;
private long maxParallelPeriod = 10000;
private long minNumberOfSegments = 3;
private long maxNumberOfSegments = 7;
private long minNumberOfJobs = 2;
......@@ -115,11 +116,12 @@ public class SystemSetup {
}
private long randomTaskPeriod(boolean serial) {
if (serial)
return ThreadLocalRandom.current().nextLong(minPeriod, maxPeriod);
else
return ThreadLocalRandom.current().nextLong(minPeriod, maxPeriod /* * 10 */);
private long randomSequentialTaskPeriod() {
return ThreadLocalRandom.current().nextLong(minPeriod, maxSequentialPeriod);
}
private long randomParallelTaskPeriod() {
return ThreadLocalRandom.current().nextLong(minPeriod, maxParallelPeriod);
}
private long randomTaskRatio(long min) {
......@@ -143,7 +145,7 @@ public class SystemSetup {
private Task generateTask() {
boolean serial = randomTaskRatio(0) > this.ratio;
long period = randomTaskPeriod(serial);
long period = serial ? randomSequentialTaskPeriod() : randomParallelTaskPeriod();
long numberOfSegments = serial ? 1 : randomNumberOfSegments();
long parallelNumberOfJobs = serial ? 1 : randomNumberOfJobs();
Set<Segment> segments = new LinkedHashSet<Segment>();
......@@ -195,9 +197,11 @@ public class SystemSetup {
return this;
}
public Builder setPeriods(long minPeriod, long maxPeriod) {
public Builder setPeriods(long minPeriod, long maxSequentialPeriod,
long maxParallelPeriod) {
this.minPeriod = minPeriod;
this.maxPeriod = maxPeriod;
this.maxSequentialPeriod = maxSequentialPeriod;
this.maxParallelPeriod = maxParallelPeriod;
return this;
}
......
......@@ -15,7 +15,7 @@ public class TestSystemSetup {
for (int i = 0; i < NUMBER_OF_SETS; ++i) {
SystemSetup taskSet = new SystemSetup.Builder().setNumberOfSegments(1, 7)
.setNumberOfJobs(2, 10).setPeriods(100, 1000).build();
.setNumberOfJobs(2, 10).setPeriods(100, 1000, 1000).build();
for (Task t : taskSet.getTasks()) {
assertTrue(t.getPeriod() >= 100);
......
package mvd.jester.tests;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import mvd.jester.model.SystemSetup;
/**
* TestMaiaBertogna
*/
public class TestMaiaBertogna {
@Test
@DisplayName("Check if the schedulability check returns the correct values.")
public void testRunSchedulabilityCheck() {
SystemSetup systemSetup = SystemSetup.readFromFile("/resources/Taskset1.txt", 0);
MaiaBertogna mb = new MaiaBertogna(systemSetup);
}
}
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