From 0c7e7687b44425ceef988526474fed02fb11018c Mon Sep 17 00:00:00 2001 From: Michael Schmid Date: Thu, 18 Jul 2019 09:39:28 +0200 Subject: [PATCH] Commit before new tests --- src/main/java/mvd/jester/tests/SchmidMottok.java | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/src/main/java/mvd/jester/tests/SchmidMottok.java b/src/main/java/mvd/jester/tests/SchmidMottok.java index b87bc7a..b5f49db 100644 --- a/src/main/java/mvd/jester/tests/SchmidMottok.java +++ b/src/main/java/mvd/jester/tests/SchmidMottok.java @@ -43,6 +43,7 @@ public class SchmidMottok extends AbstractTest { long minimumWcet = getMinimumWcet(task); long responseTime = minimumWcet; long previousResponseTime = 0; + long numberOfProcessors = systemSetup.getNumberOfProcessors(); do { previousResponseTime = responseTime; @@ -50,8 +51,10 @@ public class SchmidMottok extends AbstractTest { for (Task t : systemSetup.getTasks()) { if (t.getPeriod() < task.getPeriod()) { - interference += Math.min(getTaskInterference(t, responseTime), - responseTime - minimumWcet + 1); + for (int p = 0; p < numberOfProcessors; ++p) { + interference += Math.min(getTaskInterference(t, responseTime, p + 1), + responseTime - minimumWcet + 1); + } } } @@ -83,15 +86,45 @@ 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); + // 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 amountOfJobs = + (LongMath.divide(interval + responseTime - minWcet, period, RoundingMode.FLOOR) + + 1); + + double workload = 0; + + for (Segment s : task.getSegments()) { + long numberOfJobs = s.getNumberOfJobs() > systemSetup.getNumberOfProcessors() + ? systemSetup.getNumberOfProcessors() + : s.getNumberOfJobs(); + if (numberOfJobs >= parallelism) { + // workload += LongMath.divide(s.getNumberOfTasklets(), numberOfJobs, + // RoundingMode.CEILING) * s.getTaskletWcet(); + workload += s.getNumberOfTasklets() * s.getTaskletWcet() / numberOfJobs; + } + } - return interference; + double interference = amountOfJobs * workload; + + return interference; + } else { + throw new RuntimeException("Task was not found in task set!"); + } } private long getMinimumWcet(Task task) { @@ -103,12 +136,12 @@ 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(); - } + // private long getMaximumWcet(Task task) { + // long maxWcet = 0; + // for (Segment s : task.getSegments()) { + // maxWcet += s.getTaskletWcet() * s.getNumberOfTasklets(); + // } - return maxWcet; - } + // return maxWcet; + // } } -- libgit2 0.26.0