From 9e4cddbab5ddeb29ab00e5872bab0c288706a9bd Mon Sep 17 00:00:00 2001 From: Michael Schmid Date: Wed, 24 Jul 2019 11:33:45 +0200 Subject: [PATCH] Last changes to SchmidMottok and a few little ones --- src/main/java/mvd/jester/model/Segment.java | 6 ++++-- src/main/java/mvd/jester/tests/SchmidMottok.java | 37 ++++++++++--------------------------- src/main/java/mvd/jester/tests/TestEnvironment.java | 2 +- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/main/java/mvd/jester/model/Segment.java b/src/main/java/mvd/jester/model/Segment.java index 492cdf3..1693911 100644 --- a/src/main/java/mvd/jester/model/Segment.java +++ b/src/main/java/mvd/jester/model/Segment.java @@ -16,8 +16,10 @@ public class Segment { this.taskletWcet = this.jobWcet; this.numberOfTasklets = this.numberOfJobs; } else { - this.taskletWcet = LongMath.gcd(jobWcet, numberOfJobs); - this.numberOfTasklets = this.jobWcet * this.numberOfJobs / this.taskletWcet; + // this.taskletWcet = LongMath.gcd(jobWcet, numberOfJobs); + // this.numberOfTasklets = this.jobWcet * this.numberOfJobs / this.taskletWcet; + this.taskletWcet = numberOfJobs; + this.numberOfTasklets = jobWcet; } } diff --git a/src/main/java/mvd/jester/tests/SchmidMottok.java b/src/main/java/mvd/jester/tests/SchmidMottok.java index b5f49db..e8fc344 100644 --- a/src/main/java/mvd/jester/tests/SchmidMottok.java +++ b/src/main/java/mvd/jester/tests/SchmidMottok.java @@ -47,18 +47,21 @@ public class SchmidMottok extends AbstractTest { do { previousResponseTime = responseTime; - long interference = 0; + double taskInterference = 0; for (Task t : systemSetup.getTasks()) { if (t.getPeriod() < task.getPeriod()) { - for (int p = 0; p < numberOfProcessors; ++p) { - interference += Math.min(getTaskInterference(t, responseTime, p + 1), + long numberOfJobs = + t.getMaximumParallelism() > numberOfProcessors ? numberOfProcessors + : t.getMaximumParallelism(); + for (int p = 0; p < numberOfJobs; ++p) { + taskInterference += Math.min(getTaskInterference(t, responseTime, p + 1), responseTime - minimumWcet + 1); } } } - double taskInterference = (double) interference / systemSetup.getNumberOfProcessors(); + taskInterference /= numberOfProcessors; double selfInterference = getSelfInterference(task); long totalInterference = (long) Math.floor(taskInterference + selfInterference); @@ -66,7 +69,6 @@ public class SchmidMottok extends AbstractTest { responseTime = minimumWcet + totalInterference; } while (previousResponseTime != responseTime); - return responseTime; } @@ -86,22 +88,13 @@ public class SchmidMottok extends AbstractTest { 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) { if (responseTimes.containsKey(task)) { long responseTime = responseTimes.get(task); long minWcet = getMinimumWcet(task); long period = task.getPeriod(); + long numberOfProcessors = systemSetup.getNumberOfProcessors(); long amountOfJobs = (LongMath.divide(interval + responseTime - minWcet, period, RoundingMode.FLOOR) + 1); @@ -109,12 +102,9 @@ public class SchmidMottok extends AbstractTest { double workload = 0; for (Segment s : task.getSegments()) { - long numberOfJobs = s.getNumberOfJobs() > systemSetup.getNumberOfProcessors() - ? systemSetup.getNumberOfProcessors() + long numberOfJobs = s.getNumberOfJobs() > numberOfProcessors ? numberOfProcessors : s.getNumberOfJobs(); if (numberOfJobs >= parallelism) { - // workload += LongMath.divide(s.getNumberOfTasklets(), numberOfJobs, - // RoundingMode.CEILING) * s.getTaskletWcet(); workload += s.getNumberOfTasklets() * s.getTaskletWcet() / numberOfJobs; } } @@ -129,6 +119,7 @@ public class SchmidMottok extends AbstractTest { private long getMinimumWcet(Task task) { long minWcet = 0; + for (Segment s : task.getSegments()) { minWcet += s.getTaskletWcet(); } @@ -136,12 +127,4 @@ public class SchmidMottok extends AbstractTest { return minWcet; } - // private long getMaximumWcet(Task task) { - // long maxWcet = 0; - // for (Segment s : task.getSegments()) { - // maxWcet += s.getTaskletWcet() * s.getNumberOfTasklets(); - // } - - // return maxWcet; - // } } diff --git a/src/main/java/mvd/jester/tests/TestEnvironment.java b/src/main/java/mvd/jester/tests/TestEnvironment.java index 4a18ebd..a390c97 100644 --- a/src/main/java/mvd/jester/tests/TestEnvironment.java +++ b/src/main/java/mvd/jester/tests/TestEnvironment.java @@ -46,7 +46,7 @@ public class TestEnvironment { try { testCases.add(t.newInstance(this.systemSetup)); } catch (Exception e) { - System.out.println("Ahhh SHIT!"); + System.out.println("Could not instantiate object of AbstractTest!"); } } -- libgit2 0.26.0