Commit 43947796 by Michael Schmid

Small changes, mostly renaming

parent 39635336
...@@ -20,4 +20,15 @@ ...@@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures> </natures>
<filteredResources>
<filter>
<id>1600851289823</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription> </projectDescription>
...@@ -30,7 +30,7 @@ public class App { ...@@ -30,7 +30,7 @@ public class App {
// SchmidMottok sm = new SchmidMottok(new KnownStructure(), manager); // SchmidMottok sm = new SchmidMottok(new KnownStructure(), manager);
// JiangYi jy = new JiangYi(manager); // JiangYi jy = new JiangYi(manager);
// Set<DagTask> set = builder.generateRenyiTaskSet(7.0); // Set<DagTask> set = manager.getBuilder().generateRenyiTaskSet(7.0);
// final SortedTaskSet<DagTask> rmTasks = new SortedTaskSet<>(sm.getPriorityManager()); // final SortedTaskSet<DagTask> rmTasks = new SortedTaskSet<>(sm.getPriorityManager());
// rmTasks.addAll(set); // rmTasks.addAll(set);
...@@ -45,10 +45,10 @@ public class App { ...@@ -45,10 +45,10 @@ public class App {
new SchmidMottok(new KnownStructureWithMaxThreads(manager), manager), new SchmidMottok(new KnownStructureWithMaxThreads(manager), manager),
new SchmidMottok(new KnownStructure(), manager), new SchmidMottok(new KnownStructure(), manager),
// new MelaniButtazzo(manager), // new MelaniButtazzo(manager),
// new FonsecaNelis(manager), new FonsecaNelis(manager)
new JiangYi(manager))); /* new JiangYi(manager) */));
te.varyRenyiUtilization(manager, tests, 500); te.varyRenyiUtilization(manager, tests, 100);
} }
// { // {
// SystemManager manager = new SystemManager(8); // SystemManager manager = new SystemManager(8);
...@@ -65,16 +65,17 @@ public class App { ...@@ -65,16 +65,17 @@ public class App {
// te.varyUtilization(builder, tests, 8, 500); // te.varyUtilization(builder, tests, 8, 500);
// } // }
// { // {
// SystemManager manager = new SystemManager(8); // SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// DagTaskBuilder builder = new DagTaskBuilder();
// TestEnvironment te = new TestEnvironment(); // TestEnvironment te = new TestEnvironment();
// List<AbstractTest<DagTask>> tests = // List<AbstractTest<DagTask>> tests = te.registerTests(Arrays.asList(
// te.registerTests(Arrays.asList(new SchmidMottok(new UnkownStructure(), manager), // new SchmidMottok(new KnownStructureWithMaxThreads(manager), manager),
// new SchmidMottok(new KownStructure(), manager), // new SchmidMottok(new KnownStructure(), manager),
// new MelaniButtazzo(manager), new FonsecaNelis(manager))); // // new MelaniButtazzo(manager),
// // new FonsecaNelis(manager),
// new JiangYi(manager)));
// te.varyNumberOfProcessors(builder, tests, manager, 500); // te.varyNumberOfProcessors(manager, tests, 500);
// } // }
// { // {
// SystemManager manager = new SystemManager(8); // SystemManager manager = new SystemManager(8);
......
...@@ -238,7 +238,8 @@ public class TestEnvironment { ...@@ -238,7 +238,8 @@ public class TestEnvironment {
long checkedTasksets = 0; long checkedTasksets = 0;
final long numberOfTaskSets = ((numberOfProcessors * 4) - 3) * numberOfTaskSetsPerUtil; final long numberOfTaskSets = ((numberOfProcessors * 4) - 3) * numberOfTaskSetsPerUtil;
final ResultLogger resultLogger = new ResultLogger("utilization_" + numberOfProcessors); final ResultLogger resultLogger =
new ResultLogger("renyi_utilization_" + numberOfProcessors);
final Map<AbstractTest<DagTask>, Long> resultMap = new LinkedHashMap<>(); final Map<AbstractTest<DagTask>, Long> resultMap = new LinkedHashMap<>();
abstractTestInstances.forEach(t -> resultMap.put(t, (long) 0)); abstractTestInstances.forEach(t -> resultMap.put(t, (long) 0));
resultLogger.logHeader(resultMap, "Utilization"); resultLogger.logHeader(resultMap, "Utilization");
......
...@@ -54,8 +54,8 @@ public class DagTask extends Task { ...@@ -54,8 +54,8 @@ public class DagTask extends Task {
public long getMaximumParallelism() { public long getMaximumParallelism() {
long max = 0; long max = 0;
for (final Segment s : workloadDistribution) { for (final Segment s : workloadDistribution) {
if (max < s.getNumberOfJobs()) { if (max < s.getHeight()) {
max = s.getNumberOfJobs(); max = s.getHeight();
} }
} }
return max; return max;
......
...@@ -3,26 +3,26 @@ package mvd.jester.model; ...@@ -3,26 +3,26 @@ package mvd.jester.model;
public class Segment { public class Segment {
private final long jobWcet; private final long width;
private final long numberOfJobs; private final long height;
public Segment(long jobWcet, long numberOfJobs) { public Segment(long width, long height) {
this.jobWcet = jobWcet; this.width = width;
this.numberOfJobs = numberOfJobs; this.height = height;
} }
/** /**
* @return the numberOfJobs * @return the numberOfJobs
*/ */
public long getNumberOfJobs() { public long getHeight() {
return numberOfJobs; return height;
} }
/** /**
* @return the jobWcet * @return the jobWcet
*/ */
public long getJobWcet() { public long getWidth() {
return jobWcet; return width;
} }
} }
...@@ -64,8 +64,8 @@ public class SynchronousTask extends Task { ...@@ -64,8 +64,8 @@ public class SynchronousTask extends Task {
public long getMaximumParallelism() { public long getMaximumParallelism() {
long max = 0; long max = 0;
for (final Segment s : segments) { for (final Segment s : segments) {
if (max < s.getNumberOfJobs()) { if (max < s.getHeight()) {
max = s.getNumberOfJobs(); max = s.getHeight();
} }
} }
return max; return max;
...@@ -80,7 +80,7 @@ public class SynchronousTask extends Task { ...@@ -80,7 +80,7 @@ public class SynchronousTask extends Task {
public static long calculateWorkload(final Set<Segment> segments) { public static long calculateWorkload(final Set<Segment> segments) {
long workload = 0; long workload = 0;
for (final Segment s : segments) { for (final Segment s : segments) {
workload += s.getJobWcet() * s.getNumberOfJobs(); workload += s.getWidth() * s.getHeight();
} }
return workload; return workload;
} }
...@@ -89,7 +89,7 @@ public class SynchronousTask extends Task { ...@@ -89,7 +89,7 @@ public class SynchronousTask extends Task {
public static long calculateCriticalPath(final Set<Segment> segments) { public static long calculateCriticalPath(final Set<Segment> segments) {
long criticalPath = 0; long criticalPath = 0;
for (final Segment s : segments) { for (final Segment s : segments) {
criticalPath += s.getJobWcet(); criticalPath += s.getWidth();
} }
return criticalPath; return criticalPath;
......
...@@ -194,8 +194,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface ...@@ -194,8 +194,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
public Set<DagTask> generateRenyiTaskSet(final double totalUtilization) { public Set<DagTask> generateRenyiTaskSet(final double totalUtilization) {
final LinkedHashSet<DagTask> taskSet = new LinkedHashSet<>(); final LinkedHashSet<DagTask> taskSet = new LinkedHashSet<>();
double currentUtilization = 0; double currentUtilization = 0;
while (currentUtilization <= totalUtilization) { while (currentUtilization <= totalUtilization) {
final DagTask dagTask = generateRenyiTask(totalUtilization); final DagTask dagTask = generateRenyiTask(totalUtilization);
...@@ -207,8 +207,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface ...@@ -207,8 +207,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
final long period = final long period =
(long) Math.ceil(dagTask.getWorkload() / remainingUtilization); (long) Math.ceil(dagTask.getWorkload() / remainingUtilization);
if (period >= dagTask.getCriticalPath()) { if (period >= dagTask.getCriticalPath()) {
final DagTask modifiedTask = final DagTask modifiedTask = new DagTask(dagTask.getJobDag(), period,
new DagTask(dagTask.getJobDag(), period, numberOfProcessors); dagTask.getNumberOfThreads());
taskSet.add(modifiedTask); taskSet.add(modifiedTask);
break; break;
} }
...@@ -280,19 +280,14 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface ...@@ -280,19 +280,14 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
final long criticalPath = DagUtils.calculateCriticalPath(jobDag); final long criticalPath = DagUtils.calculateCriticalPath(jobDag);
final long period = randomRenyiPeriod(workload, criticalPath, totalUtilization); final long period = randomRenyiPeriod(workload, criticalPath, totalUtilization);
final long minNumberOfThreads = LongMath.divide(workload - criticalPath, final long numberOfThreads = randomNumberOfThreads(numberOfProcessors / 2);
period - criticalPath, RoundingMode.FLOOR);
// TODO: change back to following:
// final long numberOfThreads = randomNumberOfThreads(minNumberOfThreads);
return new DagTask(jobDag, period, minNumberOfThreads); return new DagTask(jobDag, period, numberOfThreads);
} }
private long randomRenyiPeriod(final long workload, final long criticalPath, private long randomRenyiPeriod(final long workload, final long criticalPath,
final double totalUtilization) { final double totalUtilization) {
final double firstPart = final double firstPart = (criticalPath + (double) (workload) / (0.4 * totalUtilization));
(criticalPath + (double) (workload) / (0.4 * totalUtilization));
final double gamma = new GammaDistribution(2, 1).sample(); final double gamma = new GammaDistribution(2, 1).sample();
final double secondPart = 1 + 0.25 * gamma; final double secondPart = 1 + 0.25 * gamma;
......
...@@ -25,7 +25,7 @@ public class JobContext implements JobContextInterface { ...@@ -25,7 +25,7 @@ public class JobContext implements JobContextInterface {
this.currentTasklet = Optional.empty(); this.currentTasklet = Optional.empty();
this.taskContext = taskContext; this.taskContext = taskContext;
this.segmentContext = segmentContext; this.segmentContext = segmentContext;
this.wcet = segmentContext.getSegment().getJobWcet(); this.wcet = segmentContext.getSegment().getWidth();
} }
public Optional<TaskContextInterface> updateExecution(long time) { public Optional<TaskContextInterface> updateExecution(long time) {
......
...@@ -19,8 +19,8 @@ public class SegmentContext { ...@@ -19,8 +19,8 @@ public class SegmentContext {
jobs = new HashSet<>(); jobs = new HashSet<>();
tasklets = new HashSet<>(); tasklets = new HashSet<>();
long numberOfJobs = segment.getNumberOfJobs() > numberOfProcessors ? numberOfProcessors long numberOfJobs =
: segment.getNumberOfJobs(); segment.getHeight() > numberOfProcessors ? numberOfProcessors : segment.getHeight();
for (int j = 0; j < numberOfJobs; ++j) { for (int j = 0; j < numberOfJobs; ++j) {
jobs.add(new JobContext(taskContext, this)); jobs.add(new JobContext(taskContext, this));
......
...@@ -24,7 +24,7 @@ public class JobContext implements JobContextInterface { ...@@ -24,7 +24,7 @@ public class JobContext implements JobContextInterface {
this.currentProcessor = Optional.empty(); this.currentProcessor = Optional.empty();
this.taskContext = taskContext; this.taskContext = taskContext;
this.segmentContext = segmentContext; this.segmentContext = segmentContext;
this.wcet = segmentContext.getSegment().getJobWcet(); this.wcet = segmentContext.getSegment().getWidth();
this.executionTime = wcet; this.executionTime = wcet;
} }
......
...@@ -17,7 +17,7 @@ public class SegmentContext { ...@@ -17,7 +17,7 @@ public class SegmentContext {
this.segment = segment; this.segment = segment;
jobs = new HashSet<>(); jobs = new HashSet<>();
for (int j = 0; j < segment.getNumberOfJobs(); ++j) { for (int j = 0; j < segment.getHeight(); ++j) {
jobs.add(new JobContext(taskContext, this)); jobs.add(new JobContext(taskContext, this));
} }
} }
...@@ -38,6 +38,6 @@ public class SegmentContext { ...@@ -38,6 +38,6 @@ public class SegmentContext {
@Override @Override
public String toString() { public String toString() {
return "(nJobs=" + segment.getNumberOfJobs() + ", jobWcet=" + segment.getJobWcet() + ")"; return "(nJobs=" + segment.getHeight() + ", jobWcet=" + segment.getWidth() + ")";
} }
} }
...@@ -56,7 +56,7 @@ public class TaskContext implements TaskContextInterface { ...@@ -56,7 +56,7 @@ public class TaskContext implements TaskContextInterface {
public Optional<TaskContextInterface> acceptNotification(long time) { public Optional<TaskContextInterface> acceptNotification(long time) {
segmentCounter++; segmentCounter++;
if (segmentCounter >= segments.get(currentSegment).getSegment().getNumberOfJobs()) { if (segmentCounter >= segments.get(currentSegment).getSegment().getHeight()) {
currentSegment++; currentSegment++;
segmentCounter = 0; segmentCounter = 0;
if (currentSegment >= segments.size()) { if (currentSegment >= segments.size()) {
......
...@@ -84,8 +84,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> { ...@@ -84,8 +84,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
long selfInterference = 0; long selfInterference = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
if (s.getNumberOfJobs() >= p + 1) { if (s.getHeight() >= p + 1) {
selfInterference += s.getJobWcet(); selfInterference += s.getWidth();
} }
} }
return selfInterference; return selfInterference;
...@@ -97,8 +97,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> { ...@@ -97,8 +97,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
long workloadOfBodyJobs = 0; long workloadOfBodyJobs = 0;
for (final Segment s : t.getWorkloadDistribution()) { for (final Segment s : t.getWorkloadDistribution()) {
if (s.getNumberOfJobs() >= p) { if (s.getHeight() >= p) {
workloadOfBodyJobs += s.getJobWcet(); workloadOfBodyJobs += s.getWidth();
} }
} }
...@@ -109,11 +109,11 @@ public class ChwaLee extends AbstractTest<SynchronousTask> { ...@@ -109,11 +109,11 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
final List<Segment> segmentList = new ArrayList<>(t.getWorkloadDistribution()); final List<Segment> segmentList = new ArrayList<>(t.getWorkloadDistribution());
Collections.reverse(segmentList); Collections.reverse(segmentList);
for (final Segment s : segmentList) { for (final Segment s : segmentList) {
carryInLength += s.getJobWcet(); carryInLength += s.getWidth();
if (s.getNumberOfJobs() >= p && remainingLength > carryInLength) { if (s.getHeight() >= p && remainingLength > carryInLength) {
boundedCarryInWorkload += s.getJobWcet(); boundedCarryInWorkload += s.getWidth();
} else if (s.getNumberOfJobs() >= p && remainingLength <= carryInLength) { } else if (s.getHeight() >= p && remainingLength <= carryInLength) {
boundedCarryInWorkload += s.getJobWcet() - (carryInLength - remainingLength); boundedCarryInWorkload += s.getWidth() - (carryInLength - remainingLength);
} }
if (carryInLength >= remainingLength) { if (carryInLength >= remainingLength) {
break; break;
...@@ -126,7 +126,7 @@ public class ChwaLee extends AbstractTest<SynchronousTask> { ...@@ -126,7 +126,7 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
private long getMinimumWcet(final SynchronousTask task) { private long getMinimumWcet(final SynchronousTask task) {
long minWcet = 0; long minWcet = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
minWcet += s.getJobWcet(); minWcet += s.getWidth();
} }
return minWcet; return minWcet;
......
...@@ -198,7 +198,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> { ...@@ -198,7 +198,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
Collections.reverse(reverseCarryInList); Collections.reverse(reverseCarryInList);
for (final Segment s : reverseCarryInList) { for (final Segment s : reverseCarryInList) {
carryInPeriod += s.getJobWcet(); carryInPeriod += s.getWidth();
carryOutPeriod = carryInAndOutPeriod - carryInPeriod; carryOutPeriod = carryInAndOutPeriod - carryInPeriod;
final long carryInWorkload = final long carryInWorkload =
getCarryInWorkload(task, carryInDistribution, carryInPeriod); getCarryInWorkload(task, carryInDistribution, carryInPeriod);
...@@ -212,7 +212,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> { ...@@ -212,7 +212,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
carryOutPeriod = 0; carryOutPeriod = 0;
for (final Segment s : carryOutDistribution) { for (final Segment s : carryOutDistribution) {
carryOutPeriod += s.getJobWcet(); carryOutPeriod += s.getWidth();
carryInPeriod = carryInAndOutPeriod - carryOutPeriod; carryInPeriod = carryInAndOutPeriod - carryOutPeriod;
final long carryInWorkload = final long carryInWorkload =
getCarryInWorkload(task, carryInDistribution, carryInPeriod); getCarryInWorkload(task, carryInDistribution, carryInPeriod);
...@@ -235,11 +235,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> { ...@@ -235,11 +235,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final Segment s = distributionList.get(i); final Segment s = distributionList.get(i);
long weightOfPreviousSegments = 0; long weightOfPreviousSegments = 0;
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
weightOfPreviousSegments += distributionList.get(j).getJobWcet(); weightOfPreviousSegments += distributionList.get(j).getWidth();
} }
final long width = carryOutPeriod - weightOfPreviousSegments; final long width = carryOutPeriod - weightOfPreviousSegments;
workload += Math.max(Math.min(width, s.getJobWcet()), 0) * s.getNumberOfJobs(); workload += Math.max(Math.min(width, s.getWidth()), 0) * s.getHeight();
} }
final long improvedWorkloadFromTask = final long improvedWorkloadFromTask =
...@@ -262,11 +262,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> { ...@@ -262,11 +262,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final Segment s = distributionList.get(b); final Segment s = distributionList.get(b);
long weightOfRemainingSegments = 0; long weightOfRemainingSegments = 0;
for (int p = b + 1; p < carryInDistribution.size(); ++p) { for (int p = b + 1; p < carryInDistribution.size(); ++p) {
weightOfRemainingSegments += distributionList.get(p).getJobWcet(); weightOfRemainingSegments += distributionList.get(p).getWidth();
} }
final long width = carryInPeriod - period + responseTime - weightOfRemainingSegments; final long width = carryInPeriod - period + responseTime - weightOfRemainingSegments;
workload += Math.max(Math.min(width, s.getJobWcet()), 0) * s.getNumberOfJobs(); workload += Math.max(Math.min(width, s.getWidth()), 0) * s.getHeight();
} }
final long improvedWorkload = Math.max(carryInPeriod - (period - responseTime), 0) final long improvedWorkload = Math.max(carryInPeriod - (period - responseTime), 0)
......
...@@ -91,8 +91,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> { ...@@ -91,8 +91,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
long interference = 0; long interference = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
if (s.getNumberOfJobs() >= parallelism + 1) { if (s.getHeight() >= parallelism + 1) {
interference += s.getJobWcet(); interference += s.getWidth();
} }
} }
...@@ -112,8 +112,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> { ...@@ -112,8 +112,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
long workload = 0; long workload = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
if (s.getNumberOfJobs() >= parallelism) { if (s.getHeight() >= parallelism) {
workload += s.getJobWcet(); workload += s.getWidth();
} }
} }
...@@ -128,7 +128,7 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> { ...@@ -128,7 +128,7 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
private long getMinimumWcet(final SynchronousTask task) { private long getMinimumWcet(final SynchronousTask task) {
long minWcet = 0; long minWcet = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
minWcet += s.getJobWcet(); minWcet += s.getWidth();
} }
return minWcet; return minWcet;
......
...@@ -11,6 +11,7 @@ import mvd.jester.model.SystemManagerInterface; ...@@ -11,6 +11,7 @@ import mvd.jester.model.SystemManagerInterface;
import mvd.jester.model.Task; import mvd.jester.model.Task;
import mvd.jester.priority.PriorityManager; import mvd.jester.priority.PriorityManager;
import mvd.jester.priority.RateMonotonic; import mvd.jester.priority.RateMonotonic;
import mvd.jester.tests.TypeFunction.KnownStructureWithMaxThreads;
/** /**
* SchmidMottok * SchmidMottok
...@@ -54,14 +55,6 @@ public class SchmidMottok extends AbstractTest<DagTask> { ...@@ -54,14 +55,6 @@ public class SchmidMottok extends AbstractTest<DagTask> {
long responseTime = minimumWcet; long responseTime = minimumWcet;
long previousResponseTime = 0; long previousResponseTime = 0;
long occupiedProcessors = 0; // manager.getNumberOfProcessors() + 1;
for (final DagTask t : tasks) {
if (t.getPeriod() < task.getPeriod()) {
final long numberOfProcessors = structure.getNumberOfThreads(t);
occupiedProcessors += numberOfProcessors;
}
}
do { do {
previousResponseTime = responseTime; previousResponseTime = responseTime;
double taskInterference = 0; double taskInterference = 0;
...@@ -69,13 +62,8 @@ public class SchmidMottok extends AbstractTest<DagTask> { ...@@ -69,13 +62,8 @@ public class SchmidMottok extends AbstractTest<DagTask> {
if (t.getPeriod() < task.getPeriod()) { if (t.getPeriod() < task.getPeriod()) {
final long numberOfThreads = structure.getNumberOfThreads(t); final long numberOfThreads = structure.getNumberOfThreads(t);
for (int p = 0; p < numberOfThreads; ++p) { for (int p = 0; p < numberOfThreads; ++p) {
if (occupiedProcessors > manager.getNumberOfProcessors()) { taskInterference += Math.min(structure.getTaskInterference(t, responseTimes,
taskInterference += responseTime, p + 1), responseTime - minimumWcet + 1);
Math.min(
structure.getTaskInterference(t, responseTimes,
responseTime, p + 1),
responseTime - minimumWcet + 1);
}
} }
} }
} }
......
...@@ -44,10 +44,9 @@ public interface TypeFunction { ...@@ -44,10 +44,9 @@ public interface TypeFunction {
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
final long numberOfThreads = final long numberOfThreads =
s.getNumberOfJobs() > 1 ? manager.getNumberOfProcessors() : 1; s.getHeight() > 1 ? manager.getNumberOfProcessors() : 1;
if (numberOfThreads >= parallelism) { if (numberOfThreads >= parallelism) {
workload += workload += (double) (s.getHeight() * s.getWidth()) / numberOfThreads;
(double) (s.getNumberOfJobs() * s.getJobWcet()) / numberOfThreads;
} }
} }
...@@ -98,8 +97,7 @@ public interface TypeFunction { ...@@ -98,8 +97,7 @@ public interface TypeFunction {
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
final long numberOfThreads = task.getNumberOfThreads(); final long numberOfThreads = task.getNumberOfThreads();
if (numberOfThreads >= parallelism) { if (numberOfThreads >= parallelism) {
workload += workload += (double) (s.getHeight() * s.getWidth()) / numberOfThreads;
(double) (s.getNumberOfJobs() * s.getJobWcet()) / numberOfThreads;
} }
} }
...@@ -148,11 +146,9 @@ public interface TypeFunction { ...@@ -148,11 +146,9 @@ public interface TypeFunction {
double workload = 0; double workload = 0;
for (final Segment s : task.getWorkloadDistribution()) { for (final Segment s : task.getWorkloadDistribution()) {
final long numberOfThreads = final long numberOfThreads = s.getHeight() > 1 ? task.getNumberOfThreads() : 1;
s.getNumberOfJobs() > 1 ? task.getNumberOfThreads() : 1;
if (numberOfThreads >= parallelism) { if (numberOfThreads >= parallelism) {
workload += workload += (double) (s.getHeight() * s.getWidth()) / numberOfThreads;
(double) (s.getNumberOfJobs() * s.getJobWcet()) / numberOfThreads;
} }
} }
......
...@@ -15,10 +15,10 @@ public class TestSegment { ...@@ -15,10 +15,10 @@ public class TestSegment {
Segment s1 = new Segment(100, 10); Segment s1 = new Segment(100, 10);
Segment s2 = new Segment(9, 10); Segment s2 = new Segment(9, 10);
assertTrue(s1.getJobWcet() == 100); assertTrue(s1.getWidth() == 100);
assertTrue(s1.getNumberOfJobs() == 10); assertTrue(s1.getHeight() == 10);
assertTrue(s2.getJobWcet() == 9); assertTrue(s2.getWidth() == 9);
assertTrue(s2.getNumberOfJobs() == 10); assertTrue(s2.getHeight() == 10);
} }
} }
...@@ -39,10 +39,10 @@ public class TestSystemSetup { ...@@ -39,10 +39,10 @@ public class TestSystemSetup {
long maxJobWcet = t.getPeriod() / t.getWorkloadDistribution().size(); long maxJobWcet = t.getPeriod() / t.getWorkloadDistribution().size();
for (Segment s : t.getWorkloadDistribution()) { for (Segment s : t.getWorkloadDistribution()) {
assertTrue(s.getJobWcet() >= 1); assertTrue(s.getWidth() >= 1);
assertTrue(s.getJobWcet() <= maxJobWcet); assertTrue(s.getWidth() <= maxJobWcet);
assertTrue(s.getNumberOfJobs() >= 1); assertTrue(s.getHeight() >= 1);
assertTrue(s.getNumberOfJobs() <= 10); assertTrue(s.getHeight() <= 10);
} }
assertTrue(t.getWorkloadDistribution().size() >= 1); assertTrue(t.getWorkloadDistribution().size() >= 1);
......
...@@ -32,7 +32,7 @@ public class TestJobContext { ...@@ -32,7 +32,7 @@ public class TestJobContext {
SegmentContext sc = mock(SegmentContext.class); SegmentContext sc = mock(SegmentContext.class);
Segment s = mock(Segment.class); Segment s = mock(Segment.class);
when(sc.getSegment()).thenReturn(s); when(sc.getSegment()).thenReturn(s);
when(s.getJobWcet()).thenReturn((long) 20); when(s.getWidth()).thenReturn((long) 20);
when(sc.getNextTasklet()).thenReturn(Optional.of(tlc)) when(sc.getNextTasklet()).thenReturn(Optional.of(tlc))
.thenReturn(Optional.ofNullable(null)); .thenReturn(Optional.ofNullable(null));
...@@ -53,7 +53,7 @@ public class TestJobContext { ...@@ -53,7 +53,7 @@ public class TestJobContext {
SegmentContext sc = mock(SegmentContext.class); SegmentContext sc = mock(SegmentContext.class);
Segment s = mock(Segment.class); Segment s = mock(Segment.class);
when(sc.getSegment()).thenReturn(s); when(sc.getSegment()).thenReturn(s);
when(s.getJobWcet()).thenReturn((long) 20); when(s.getWidth()).thenReturn((long) 20);
when(tlc.checkExecutionTime()).thenReturn(true, false); when(tlc.checkExecutionTime()).thenReturn(true, false);
JobContext jc = new JobContext(tc, sc); JobContext jc = new JobContext(tc, sc);
...@@ -75,7 +75,7 @@ public class TestJobContext { ...@@ -75,7 +75,7 @@ public class TestJobContext {
when(sc.getSegment()).thenReturn(s); when(sc.getSegment()).thenReturn(s);
when(sc.getNextTasklet()).thenReturn(Optional.ofNullable(tlc)) when(sc.getNextTasklet()).thenReturn(Optional.ofNullable(tlc))
.thenReturn(Optional.ofNullable(null)); .thenReturn(Optional.ofNullable(null));
when(s.getJobWcet()).thenReturn((long) 20); when(s.getWidth()).thenReturn((long) 20);
when(tlc.checkExecutionTime()).thenReturn(true, false); when(tlc.checkExecutionTime()).thenReturn(true, false);
when(tlc.updateExecution(not(eq(0)))).thenReturn(true); when(tlc.updateExecution(not(eq(0)))).thenReturn(true);
when(tlc.updateExecution(0)).thenReturn(false); when(tlc.updateExecution(0)).thenReturn(false);
......
...@@ -31,7 +31,7 @@ public class TestJobContext { ...@@ -31,7 +31,7 @@ public class TestJobContext {
long jobWcet = ThreadLocalRandom.current().nextLong(20, 50); long jobWcet = ThreadLocalRandom.current().nextLong(20, 50);
Segment s = mock(Segment.class); Segment s = mock(Segment.class);
when(s.getJobWcet()).thenReturn(jobWcet); when(s.getWidth()).thenReturn(jobWcet);
SegmentContext sc = mock(SegmentContext.class); SegmentContext sc = mock(SegmentContext.class);
when(sc.getSegment()).thenReturn(s); when(sc.getSegment()).thenReturn(s);
TaskContext tc = mock(TaskContext.class); TaskContext tc = mock(TaskContext.class);
......
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