Commit 9e4cddba by Michael Schmid

Last changes to SchmidMottok and a few little ones

parent 0c7e7687
...@@ -16,8 +16,10 @@ public class Segment { ...@@ -16,8 +16,10 @@ public class Segment {
this.taskletWcet = this.jobWcet; this.taskletWcet = this.jobWcet;
this.numberOfTasklets = this.numberOfJobs; this.numberOfTasklets = this.numberOfJobs;
} else { } else {
this.taskletWcet = LongMath.gcd(jobWcet, numberOfJobs); // this.taskletWcet = LongMath.gcd(jobWcet, numberOfJobs);
this.numberOfTasklets = this.jobWcet * this.numberOfJobs / this.taskletWcet; // this.numberOfTasklets = this.jobWcet * this.numberOfJobs / this.taskletWcet;
this.taskletWcet = numberOfJobs;
this.numberOfTasklets = jobWcet;
} }
} }
......
...@@ -47,18 +47,21 @@ public class SchmidMottok extends AbstractTest { ...@@ -47,18 +47,21 @@ public class SchmidMottok extends AbstractTest {
do { do {
previousResponseTime = responseTime; previousResponseTime = responseTime;
long interference = 0; double taskInterference = 0;
for (Task t : systemSetup.getTasks()) { for (Task t : systemSetup.getTasks()) {
if (t.getPeriod() < task.getPeriod()) { if (t.getPeriod() < task.getPeriod()) {
for (int p = 0; p < numberOfProcessors; ++p) { long numberOfJobs =
interference += Math.min(getTaskInterference(t, responseTime, p + 1), t.getMaximumParallelism() > numberOfProcessors ? numberOfProcessors
: t.getMaximumParallelism();
for (int p = 0; p < numberOfJobs; ++p) {
taskInterference += Math.min(getTaskInterference(t, responseTime, p + 1),
responseTime - minimumWcet + 1); responseTime - minimumWcet + 1);
} }
} }
} }
double taskInterference = (double) interference / systemSetup.getNumberOfProcessors(); taskInterference /= numberOfProcessors;
double selfInterference = getSelfInterference(task); double selfInterference = getSelfInterference(task);
long totalInterference = (long) Math.floor(taskInterference + selfInterference); long totalInterference = (long) Math.floor(taskInterference + selfInterference);
...@@ -66,7 +69,6 @@ public class SchmidMottok extends AbstractTest { ...@@ -66,7 +69,6 @@ public class SchmidMottok extends AbstractTest {
responseTime = minimumWcet + totalInterference; responseTime = minimumWcet + totalInterference;
} while (previousResponseTime != responseTime); } while (previousResponseTime != responseTime);
return responseTime; return responseTime;
} }
...@@ -86,22 +88,13 @@ public class SchmidMottok extends AbstractTest { ...@@ -86,22 +88,13 @@ public class SchmidMottok extends AbstractTest {
return interference; return interference;
} }
// private long getTaskInterference(Task task, long interval) {
// long responseTime = responseTimes.get(task);
// long minWcet = getMinimumWcet(task);
// long period = task.getPeriod();
// long interference =
// (LongMath.divide(interval + responseTime - minWcet, period, RoundingMode.FLOOR) + 1)
// * getMaximumWcet(task);
// return interference;
// }
private double getTaskInterference(Task task, long interval, long parallelism) { private double getTaskInterference(Task task, long interval, long parallelism) {
if (responseTimes.containsKey(task)) { if (responseTimes.containsKey(task)) {
long responseTime = responseTimes.get(task); long responseTime = responseTimes.get(task);
long minWcet = getMinimumWcet(task); long minWcet = getMinimumWcet(task);
long period = task.getPeriod(); long period = task.getPeriod();
long numberOfProcessors = systemSetup.getNumberOfProcessors();
long amountOfJobs = long amountOfJobs =
(LongMath.divide(interval + responseTime - minWcet, period, RoundingMode.FLOOR) (LongMath.divide(interval + responseTime - minWcet, period, RoundingMode.FLOOR)
+ 1); + 1);
...@@ -109,12 +102,9 @@ public class SchmidMottok extends AbstractTest { ...@@ -109,12 +102,9 @@ public class SchmidMottok extends AbstractTest {
double workload = 0; double workload = 0;
for (Segment s : task.getSegments()) { for (Segment s : task.getSegments()) {
long numberOfJobs = s.getNumberOfJobs() > systemSetup.getNumberOfProcessors() long numberOfJobs = s.getNumberOfJobs() > numberOfProcessors ? numberOfProcessors
? systemSetup.getNumberOfProcessors()
: s.getNumberOfJobs(); : s.getNumberOfJobs();
if (numberOfJobs >= parallelism) { if (numberOfJobs >= parallelism) {
// workload += LongMath.divide(s.getNumberOfTasklets(), numberOfJobs,
// RoundingMode.CEILING) * s.getTaskletWcet();
workload += s.getNumberOfTasklets() * s.getTaskletWcet() / numberOfJobs; workload += s.getNumberOfTasklets() * s.getTaskletWcet() / numberOfJobs;
} }
} }
...@@ -129,6 +119,7 @@ public class SchmidMottok extends AbstractTest { ...@@ -129,6 +119,7 @@ public class SchmidMottok extends AbstractTest {
private long getMinimumWcet(Task task) { private long getMinimumWcet(Task task) {
long minWcet = 0; long minWcet = 0;
for (Segment s : task.getSegments()) { for (Segment s : task.getSegments()) {
minWcet += s.getTaskletWcet(); minWcet += s.getTaskletWcet();
} }
...@@ -136,12 +127,4 @@ public class SchmidMottok extends AbstractTest { ...@@ -136,12 +127,4 @@ public class SchmidMottok extends AbstractTest {
return minWcet; return minWcet;
} }
// private long getMaximumWcet(Task task) {
// long maxWcet = 0;
// for (Segment s : task.getSegments()) {
// maxWcet += s.getTaskletWcet() * s.getNumberOfTasklets();
// }
// return maxWcet;
// }
} }
...@@ -46,7 +46,7 @@ public class TestEnvironment { ...@@ -46,7 +46,7 @@ public class TestEnvironment {
try { try {
testCases.add(t.newInstance(this.systemSetup)); testCases.add(t.newInstance(this.systemSetup));
} catch (Exception e) { } catch (Exception e) {
System.out.println("Ahhh SHIT!"); System.out.println("Could not instantiate object of AbstractTest!");
} }
} }
......
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