Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
jester
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
39635336
authored
Sep 02, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrated builder into manager
parent
eb53dcfb
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
125 additions
and
100 deletions
+125
-100
src/main/java/mvd/jester/App.java
+20
-21
src/main/java/mvd/jester/TestEnvironment.java
+20
-19
src/main/java/mvd/jester/model/SystemManager.java
+40
-25
src/main/java/mvd/jester/model/SystemManagerInterface.java
+7
-0
src/main/java/mvd/jester/tests/AbstractTest.java
+3
-3
src/main/java/mvd/jester/tests/ChwaLee.java
+2
-2
src/main/java/mvd/jester/tests/FonsecaNelis.java
+2
-2
src/main/java/mvd/jester/tests/JiangYi.java
+2
-2
src/main/java/mvd/jester/tests/MaiaBertogna.java
+2
-2
src/main/java/mvd/jester/tests/MelaniButtazzo.java
+2
-2
src/main/java/mvd/jester/tests/SchmidMottok.java
+12
-13
src/main/java/mvd/jester/tests/TypeFunction.java
+7
-7
src/test/java/mvd/jester/priority/TestEarliestDeadlineFirst.java
+3
-1
src/test/java/mvd/jester/priority/TestRateMonotonic.java
+3
-1
No files found.
src/main/java/mvd/jester/App.java
View file @
39635336
...
...
@@ -23,34 +23,33 @@ import mvd.jester.tests.TypeFunction.UnkownStructure;
*/
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
// {
// SystemManager manager = new SystemManager(8);
// DagTaskBuilder builder = new DagTaskBuilder();
// TestEnvironment te = new TestEnvironment();
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
TestEnvironment
te
=
new
TestEnvironment
();
//
// SchmidMottok sm = new SchmidMottok(new KnownStructure(), manager);
//
// JiangYi jy = new JiangYi(manager);
// SchmidMottok sm = new SchmidMottok(new KnownStructure(), manager);
// JiangYi jy = new JiangYi(manager);
//
// Set<DagTask> set = builder.generateRenyiTaskSet(7.0);
//
// final SortedTaskSet<DagTask> rmTasks = new SortedTaskSet<>(sm.getPriorityManager());
//
// rmTasks.addAll(set);
// Set<DagTask> set = builder.generateRenyiTaskSet(7.0);
// final SortedTaskSet<DagTask> rmTasks = new SortedTaskSet<>(sm.getPriorityManager());
// rmTasks.addAll(set);
//
// final SortedTaskSet<DagTask> edfTasks = new SortedTaskSet<>(jy.getPriorityManager());
//
// edfTasks.addAll(set);
// final SortedTaskSet<DagTask> edfTasks = new SortedTaskSet<>(jy.getPriorityManager());
// edfTasks.addAll(set);
//
// jy.runSchedulabilityCheck(edfTasks);
//
// sm.runSchedulabilityCheck(rmTasks);
// jy.runSchedulabilityCheck(edfTasks);
// sm.runSchedulabilityCheck(rmTasks);
//
List<AbstractTest<DagTask>> tests = te.registerTests(Arrays.asList(
//
new SchmidMottok(new KnownStructureWithMaxThreads(manager), manager),
//
new SchmidMottok(new KnownStructure(), manager),
//
// new MelaniButtazzo(manager),
//
// new FonsecaNelis(manager),
//
new JiangYi(manager)));
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
new
SchmidMottok
(
new
KnownStructureWithMaxThreads
(
manager
),
manager
),
new
SchmidMottok
(
new
KnownStructure
(),
manager
),
// new MelaniButtazzo(manager),
// new FonsecaNelis(manager),
new
JiangYi
(
manager
)));
// te.varyRenyiUtilization(builder, tests, 8
, 500);
//
}
te
.
varyRenyiUtilization
(
manager
,
tests
,
500
);
}
// {
// SystemManager manager = new SystemManager(8);
// DagTaskBuilder builder = new DagTaskBuilder();
...
...
src/main/java/mvd/jester/TestEnvironment.java
View file @
39635336
...
...
@@ -78,15 +78,15 @@ public class TestEnvironment {
// resultLogger.logTests(abstractTestInstances);
}
public
void
measureExecutionTimes
(
final
DagTaskBuilder
build
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
SystemManager
manager
,
public
void
measureExecutionTimes
(
final
SystemManager
<
DagTaskBuilder
>
manag
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfMeasurements
)
{
Map
<
AbstractTest
<
DagTask
>,
List
<
Long
>>
results
=
new
LinkedHashMap
<>();
abstractTestInstances
.
forEach
(
t
->
results
.
put
(
t
,
new
ArrayList
<>()));
for
(
int
i
=
0
;
i
<
numberOfMeasurements
;
++
i
)
{
double
utilization
=
ThreadLocalRandom
.
current
().
nextDouble
(
1
,
manager
.
getNumberOfProcessors
());
Set
<
DagTask
>
taskSet
=
builder
.
generateTaskSet
(
utilization
);
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateTaskSet
(
utilization
);
for
(
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
final
PriorityManager
priorityManager
=
testInstance
.
getPriorityManager
();
...
...
@@ -108,8 +108,8 @@ public class TestEnvironment {
}
public
void
varyNumberOfProcessors
(
final
DagTaskBuilder
build
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
SystemManager
manager
,
public
void
varyNumberOfProcessors
(
final
SystemManager
<
DagTaskBuilder
>
manag
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfTaskSetsPerStep
)
{
long
checkedTasksets
=
0
;
final
long
numberOfTaskSets
=
8
*
numberOfTaskSetsPerStep
;
...
...
@@ -123,7 +123,7 @@ public class TestEnvironment {
manager
.
setNumberOfProcessors
(
numberOfProcessors
);
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerStep
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
builder
.
generateUUnifastTaskSet
(
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateUUnifastTaskSet
(
(
long
)
(
1.5
*
numberOfProcessors
),
(
double
)
numberOfProcessors
*
0.5
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
...
...
@@ -150,10 +150,11 @@ public class TestEnvironment {
}
public
void
varyNumberOfTasks
(
final
DagTaskBuilder
build
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfProcessors
,
public
void
varyNumberOfTasks
(
final
SystemManager
<
DagTaskBuilder
>
manag
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfTaskSetsPerStep
)
{
long
checkedTasksets
=
0
;
final
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
final
long
numberOfTaskSets
=
9
*
numberOfTaskSetsPerStep
;
final
ResultLogger
resultLogger
=
new
ResultLogger
(
"numberOfTasks_"
+
numberOfProcessors
);
...
...
@@ -164,8 +165,8 @@ public class TestEnvironment {
for
(
long
numberOfTasks
=
4
;
numberOfTasks
<=
20
;
numberOfTasks
+=
2
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerStep
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
builder
.
generateUUnifastTaskSet
(
numberOfTasks
,
(
double
)
numberOfProcessors
*
0.5
);
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateUUnifastTaskSet
(
numberOfTasks
,
(
double
)
numberOfProcessors
*
0.5
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
...
...
@@ -190,10 +191,10 @@ public class TestEnvironment {
resultLogger
.
finalize
();
}
public
void
varyUtilization
(
final
DagTaskBuilder
build
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfProcessors
,
public
void
varyUtilization
(
final
SystemManager
<
DagTaskBuilder
>
manag
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfTaskSetsPerUtil
)
{
final
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
long
checkedTasksets
=
0
;
final
long
numberOfTaskSets
=
((
numberOfProcessors
*
4
)
-
3
)
*
numberOfTaskSetsPerUtil
;
...
...
@@ -205,7 +206,7 @@ public class TestEnvironment {
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
builder
.
generateTaskSet
(
util
);
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateTaskSet
(
util
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
...
...
@@ -230,10 +231,10 @@ public class TestEnvironment {
resultLogger
.
finalize
();
}
public
void
varyRenyiUtilization
(
final
DagTaskBuilder
build
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfProcessors
,
public
void
varyRenyiUtilization
(
final
SystemManager
<
DagTaskBuilder
>
manag
er
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfTaskSetsPerUtil
)
{
final
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
long
checkedTasksets
=
0
;
final
long
numberOfTaskSets
=
((
numberOfProcessors
*
4
)
-
3
)
*
numberOfTaskSetsPerUtil
;
...
...
@@ -242,10 +243,10 @@ public class TestEnvironment {
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
resultLogger
.
logHeader
(
resultMap
,
"Utilization"
);
for
(
double
util
=
5
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
builder
.
generateRenyiTaskSet
(
util
);
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateRenyiTaskSet
(
util
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
...
...
src/main/java/mvd/jester/model/SystemManager.java
View file @
39635336
...
...
@@ -14,32 +14,50 @@ import org.apache.commons.math3.distribution.GammaDistribution;
import
org.jgrapht.experimental.dag.DirectedAcyclicGraph
;
import
org.jgrapht.graph.DefaultEdge
;
import
mvd.jester.utils.DagUtils
;
import
mvd.jester.model.SystemManager.Builder
;
/**
* TaskSet
*/
public
class
SystemManager
{
private
long
numberOfProcessors
;
public
class
SystemManager
<
T
extends
Builder
>
implements
SystemManagerInterface
{
public
SystemManager
(
final
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
private
final
T
builder
;
public
SystemManager
(
Class
<
T
>
builder
)
{
try
{
this
.
builder
=
builder
.
getDeclaredConstructor
().
newInstance
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Builder could not be instantiated!"
);
}
}
/**
* @return the numberOfProcessors
*/
public
long
getNumberOfProcessors
()
{
return
numberOfProcessors
;
return
builder
.
getNumberOfProcessors
()
;
}
/**
* @param numberOfProcessors the numberOfProcessors to set
*/
public
void
setNumberOfProcessors
(
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
builder
.
setNumberOfProcessors
(
numberOfProcessors
)
;
}
public
static
class
SynchronousTaskBuilder
{
public
T
getBuilder
()
{
return
builder
;
}
public
static
interface
Builder
{
public
long
getNumberOfProcessors
();
public
Builder
setNumberOfProcessors
(
long
numberOfProcessors
);
}
public
static
class
SynchronousTaskBuilder
implements
Builder
{
private
long
numberOfProcessors
=
4
;
private
long
minPeriod
=
100
;
private
long
maxSequentialPeriod
=
1000
;
...
...
@@ -53,7 +71,6 @@ public class SystemManager {
private
final
long
parallelTaskRatio
=
0
;
public
SynchronousTaskBuilder
()
{
}
private
long
randomSequentialTaskPeriod
()
{
...
...
@@ -110,21 +127,11 @@ public class SystemManager {
return
taskSet
;
}
// public SystemSetup<SynchronousTask> build() {
// this.ratio = randomTaskRatio(this.parallelTaskRatio);
// final Set<SynchronousTask> taskSet = generateTaskSet();
// return new SystemSetup<>(taskSet, numberOfProcessors);
// }
// public Set<SynchronousTask> rebuild(final SystemSetup<SynchronousTask> systemSetup) {
// this.ratio = randomTaskRatio(this.parallelTaskRatio);
// return generateTaskSet();
// }
public
boolean
addTask
(
final
Set
<
SynchronousTask
>
taskSet
)
{
return
taskSet
.
add
(
generateTask
());
}
@Override
public
SynchronousTaskBuilder
setNumberOfProcessors
(
final
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
...
...
@@ -157,9 +164,14 @@ public class SystemManager {
this
.
maxNumberOfJobs
=
maxNumberOfJobs
;
return
this
;
}
@Override
public
long
getNumberOfProcessors
()
{
return
numberOfProcessors
;
}
}
public
static
class
DagTaskBuilder
{
public
static
class
DagTaskBuilder
implements
Builder
{
private
long
numberOfProcessors
=
8
;
private
long
minimumWcet
=
1
;
private
long
maximumWcet
=
100
;
...
...
@@ -167,7 +179,7 @@ public class SystemManager {
private
long
maxNumberOfThreads
=
numberOfProcessors
;
private
long
depth
=
2
;
private
long
p_par
=
80
;
private
long
p_add
=
1
0
;
// TODO: Change back to 0.2
private
long
p_add
=
2
0
;
// TODO: Change back to 0.2
public
DagTaskBuilder
()
{
}
...
...
@@ -268,12 +280,13 @@ public class SystemManager {
final
long
criticalPath
=
DagUtils
.
calculateCriticalPath
(
jobDag
);
final
long
period
=
randomRenyiPeriod
(
workload
,
criticalPath
,
totalUtilization
);
// final long n
umberOfThreads = LongMath.divide(workload - criticalPath,
// period - criticalPath, RoundingMode.CEILING) + 1
;
final
long
minN
umberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
FLOOR
)
;
final
long
numberOfThreads
=
randomNumberOfThreads
(
numberOfProcessors
/
2
);
// TODO: change back to following:
// final long numberOfThreads = randomNumberOfThreads(minNumberOfThreads);
return
new
DagTask
(
jobDag
,
period
,
n
umberOfThreads
);
return
new
DagTask
(
jobDag
,
period
,
minN
umberOfThreads
);
}
private
long
randomRenyiPeriod
(
final
long
workload
,
final
long
criticalPath
,
...
...
@@ -448,6 +461,7 @@ public class SystemManager {
/**
* @param numberOfProcessors the numberOfProcessors to set
*/
@Override
public
DagTaskBuilder
setNumberOfProcessors
(
final
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
return
this
;
...
...
@@ -456,6 +470,7 @@ public class SystemManager {
/**
* @return the numberOfProcessors
*/
@Override
public
long
getNumberOfProcessors
()
{
return
numberOfProcessors
;
}
...
...
src/main/java/mvd/jester/model/SystemManagerInterface.java
0 → 100644
View file @
39635336
package
mvd
.
jester
.
model
;
public
interface
SystemManagerInterface
{
public
long
getNumberOfProcessors
();
}
src/main/java/mvd/jester/tests/AbstractTest.java
View file @
39635336
package
mvd
.
jester
.
tests
;
import
mvd.jester.TypeInterface
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
/**
...
...
@@ -9,9 +9,9 @@ import mvd.jester.model.Task;
*/
public
abstract
class
AbstractTest
<
T
extends
Task
>
implements
TestInterface
<
T
>,
TypeInterface
{
protected
final
SystemManager
manager
;
protected
final
SystemManager
Interface
manager
;
public
AbstractTest
(
final
SystemManager
manager
)
{
public
AbstractTest
(
final
SystemManager
Interface
manager
)
{
this
.
manager
=
manager
;
}
...
...
src/main/java/mvd/jester/tests/ChwaLee.java
View file @
39635336
...
...
@@ -13,7 +13,7 @@ import mvd.jester.info.TerminationInfo;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SynchronousTask
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.priority.EarliestDeadlineFirst
;
import
mvd.jester.priority.PriorityManager
;
...
...
@@ -25,7 +25,7 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
private
final
Map
<
SynchronousTask
,
TerminationInfo
>
responseTimes
;
private
final
PriorityManager
priorityManager
;
public
ChwaLee
(
final
SystemManager
manager
)
{
public
ChwaLee
(
final
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
EarliestDeadlineFirst
();
...
...
src/main/java/mvd/jester/tests/FonsecaNelis.java
View file @
39635336
...
...
@@ -21,7 +21,7 @@ import mvd.jester.model.DagTask;
import
mvd.jester.model.Job
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.TreeJob
;
import
mvd.jester.utils.DagUtils
;
...
...
@@ -37,7 +37,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
private
final
PriorityManager
priorityManager
;
private
final
Map
<
Task
,
Set
<
Segment
>>
carryOutSegments
;
public
FonsecaNelis
(
final
SystemManager
manager
)
{
public
FonsecaNelis
(
final
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
...
...
src/main/java/mvd/jester/tests/JiangYi.java
View file @
39635336
...
...
@@ -12,7 +12,7 @@ import mvd.jester.info.SchedulingInfo.Feasiblity;
import
mvd.jester.model.ContainerTask
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.EarliestDeadlineFirst
;
import
mvd.jester.priority.PriorityManager
;
...
...
@@ -21,7 +21,7 @@ public class JiangYi extends AbstractTest<DagTask> {
private
final
EarliestDeadlineFirst
priorityManager
;
public
JiangYi
(
SystemManager
manager
)
{
public
JiangYi
(
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
priorityManager
=
new
EarliestDeadlineFirst
();
}
...
...
src/main/java/mvd/jester/tests/MaiaBertogna.java
View file @
39635336
...
...
@@ -10,7 +10,7 @@ import mvd.jester.info.TerminationInfo;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SynchronousTask
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
...
...
@@ -22,7 +22,7 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
private
final
Map
<
SynchronousTask
,
TerminationInfo
>
responseTimes
;
private
final
PriorityManager
priorityManager
;
public
MaiaBertogna
(
final
SystemManager
manager
)
{
public
MaiaBertogna
(
final
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
...
...
src/main/java/mvd/jester/tests/MelaniButtazzo.java
View file @
39635336
...
...
@@ -9,7 +9,7 @@ import mvd.jester.info.SchedulingInfo;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
...
...
@@ -19,7 +19,7 @@ public class MelaniButtazzo extends AbstractTest<DagTask> {
private
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
private
final
PriorityManager
priorityManager
;
public
MelaniButtazzo
(
final
SystemManager
manager
)
{
public
MelaniButtazzo
(
final
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
...
...
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
39635336
...
...
@@ -7,7 +7,7 @@ import mvd.jester.info.SchedulingInfo;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
...
...
@@ -21,7 +21,7 @@ public class SchmidMottok extends AbstractTest<DagTask> {
private
final
PriorityManager
priorityManager
;
private
final
TypeFunction
structure
;
public
SchmidMottok
(
TypeFunction
structure
,
final
SystemManager
manager
)
{
public
SchmidMottok
(
TypeFunction
structure
,
final
SystemManager
Interface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
...
...
@@ -54,22 +54,21 @@ public class SchmidMottok extends AbstractTest<DagTask> {
long
responseTime
=
minimumWcet
;
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
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
long
occupiedProcessors
=
manager
.
getNumberOfProcessors
()
+
1
;
// for (final DagTask t : tasks) {
// if (t.getPeriod() < task.getPeriod()) {
// final long numberOfProcessors = structure.getNumerOfThreads(t);
// occupiedProcessors += numberOfProcessors;
// }
// }
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOf
Processors
=
structure
.
getNum
erOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOf
Processor
s
;
++
p
)
{
final
long
numberOf
Threads
=
structure
.
getNumb
erOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOf
Thread
s
;
++
p
)
{
if
(
occupiedProcessors
>
manager
.
getNumberOfProcessors
())
{
taskInterference
+=
Math
.
min
(
...
...
src/main/java/mvd/jester/tests/TypeFunction.java
View file @
39635336
...
...
@@ -6,7 +6,7 @@ import com.google.common.math.LongMath;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager
Interface
;
import
mvd.jester.model.Task
;
public
interface
TypeFunction
{
...
...
@@ -17,15 +17,15 @@ public interface TypeFunction {
public
double
getSelfInterference
(
final
DagTask
task
);
public
long
getNumerOfThreads
(
final
DagTask
task
);
public
long
getNum
b
erOfThreads
(
final
DagTask
task
);
public
String
getType
();
public
class
KnownStructureWithMaxThreads
implements
TypeFunction
{
private
final
SystemManager
manager
;
private
final
SystemManager
Interface
manager
;
public
KnownStructureWithMaxThreads
(
final
SystemManager
manager
)
{
public
KnownStructureWithMaxThreads
(
final
SystemManager
Interface
manager
)
{
this
.
manager
=
manager
;
}
...
...
@@ -75,7 +75,7 @@ public interface TypeFunction {
}
@Override
public
long
getNumerOfThreads
(
final
DagTask
task
)
{
public
long
getNum
b
erOfThreads
(
final
DagTask
task
)
{
return
manager
.
getNumberOfProcessors
();
}
}
...
...
@@ -127,7 +127,7 @@ public interface TypeFunction {
}
@Override
public
long
getNumerOfThreads
(
final
DagTask
task
)
{
public
long
getNum
b
erOfThreads
(
final
DagTask
task
)
{
return
task
.
getNumberOfThreads
();
}
}
...
...
@@ -180,7 +180,7 @@ public interface TypeFunction {
}
@Override
public
long
getNumerOfThreads
(
final
DagTask
task
)
{
public
long
getNum
b
erOfThreads
(
final
DagTask
task
)
{
return
task
.
getNumberOfThreads
();
}
}
...
...
src/test/java/mvd/jester/priority/TestEarliestDeadlineFirst.java
View file @
39635336
...
...
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.DisplayName;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.SynchronousTask
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager.SynchronousTaskBuilder
;
import
mvd.jester.simulator.DynamicForkJoin
;
import
mvd.jester.simulator.ParallelSynchronous
;
import
mvd.jester.simulator.internals.parallelsynchronous.TaskContext
;
...
...
@@ -49,7 +50,8 @@ public class TestEarliestDeadlineFirst {
@DisplayName
(
"Check Getters, Tests and Simulators."
)
void
testGettersTestsAndSimulators
()
{
EarliestDeadlineFirst
edf
=
new
EarliestDeadlineFirst
();
SystemManager
manager
=
new
SystemManager
(
4
);
SystemManager
<
SynchronousTaskBuilder
>
manager
=
new
SystemManager
<>(
SynchronousTaskBuilder
.
class
);
assertTrue
(
edf
.
hasTest
(
ChwaLee
.
class
));
assertFalse
(
edf
.
hasTest
(
MaiaBertogna
.
class
));
assertFalse
(
edf
.
hasTest
(
SchmidMottok
.
class
));
...
...
src/test/java/mvd/jester/priority/TestRateMonotonic.java
View file @
39635336
...
...
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.DisplayName;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.SynchronousTask
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager.SynchronousTaskBuilder
;
import
mvd.jester.simulator.DynamicForkJoin
;
import
mvd.jester.simulator.ParallelSynchronous
;
import
mvd.jester.simulator.internals.parallelsynchronous.TaskContext
;
...
...
@@ -48,7 +49,8 @@ public class TestRateMonotonic {
@DisplayName
(
"Check Tests and Simulators."
)
void
testTestsAndSimulators
()
{
RateMonotonic
rm
=
new
RateMonotonic
();
SystemManager
manager
=
new
SystemManager
(
8
);
SystemManager
<
SynchronousTaskBuilder
>
manager
=
new
SystemManager
<>(
SynchronousTaskBuilder
.
class
);
assertFalse
(
rm
.
hasTest
(
ChwaLee
.
class
));
assertTrue
(
rm
.
hasTest
(
MaiaBertogna
.
class
));
assertTrue
(
rm
.
hasTest
(
SchmidMottok
.
class
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment