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
8054de06
authored
Oct 26, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small changes and improved response time
parent
84d3cbf6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
275 additions
and
111 deletions
+275
-111
src/main/java/mvd/jester/App.java
+50
-58
src/main/java/mvd/jester/TestEnvironment.java
+44
-3
src/main/java/mvd/jester/model/SystemManager.java
+68
-15
src/main/java/mvd/jester/model/Task.java
+4
-1
src/main/java/mvd/jester/tests/SchmidMottok.java
+57
-17
src/main/java/mvd/jester/tests/Tester.java
+50
-15
src/main/java/mvd/jester/tests/TypeFunction.java
+1
-1
src/test/java/mvd/jester/priority/TestRateMonotonic.java
+1
-1
No files found.
src/main/java/mvd/jester/App.java
View file @
8054de06
...
...
@@ -2,21 +2,14 @@ package mvd.jester;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManager
;
import
mvd.jester.model.SystemManager.DagTaskBuilder
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.tests.FonsecaNelis
;
import
mvd.jester.tests.JiangYi
;
import
mvd.jester.tests.MelaniButtazzo
;
import
mvd.jester.tests.SchmidMottok
;
import
mvd.jester.tests.Tester
;
import
mvd.jester.tests.TypeFunction.KnownStructureWithMaxThreads
;
import
mvd.jester.tests.TypeFunction.KnownStructure
;
import
mvd.jester.tests.TypeFunction.UnkownStructure
;
import
mvd.jester.tests.TypeFunction.TestFunction
;
import
mvd.jester.tests.TypeFunction.UnknownStructure
;
/**
...
...
@@ -27,66 +20,65 @@ public class App {
public
static
void
main
(
String
[]
args
)
{
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
manager
.
setNumberOfProcessors
(
32
);
manager
.
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
();
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
new
SchmidMottok
(
new
KnownStructureWithMaxThreads
(
manager
),
manager
),
new
Tester
(
new
KnownStructure
(),
manager
),
// new MelaniButtazzo(manager),
// new FonsecaNelis(manager)
new
JiangYi
(
manager
)));
/* new SchmidMottok(new KnownStructure(), manager), */
new
SchmidMottok
(
new
UnknownStructure
(),
manager
),
// new Tester(new UnknownStructure(), manager),
// new MelaniButtazzo(manager),,
new
FonsecaNelis
(
manager
),
//
new
JiangYi
(
manager
)
//
));
te
.
varyRenyiUtilization
(
manager
,
tests
,
1
00
);
te
.
varyRenyiUtilization
(
manager
,
tests
,
5
00
);
}
// {
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// TestEnvironment te = new TestEnvironment();
// 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)
// ));
// te.varyUtilization(manager, tests, 500);
// }
// {
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// TestEnvironment te = new TestEnvironment();
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
manager
.
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
();
// 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 KnownStructure(), manager), */
new
SchmidMottok
(
new
UnknownStructure
(),
manager
),
// new Tester(new UnknownStructure(), manager),
// new MelaniButtazzo(manager),,
new
FonsecaNelis
(
manager
),
//
new
JiangYi
(
manager
)
//
));
// te.varyNumberOfProcessors
(manager, tests, 500);
//
}
//
{
// SystemManager manager = new SystemManager(8
);
// DagTaskBuilder builder = new DagTaskBuilder(
);
//
TestEnvironment te = new TestEnvironment();
te
.
varyPropability
(
manager
,
tests
,
500
);
}
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
manager
.
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
();
// List<AbstractTest<DagTask>> tests =
// te.registerTests(Arrays.asList(new SchmidMottok(new UnkownStructure(), manager),
// new SchmidMottok(new KownStructure(), manager),
// new MelaniButtazzo(manager), new FonsecaNelis(manager)));
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
//
// new SchmidMottok(new KnownStructure(), manager), //
new
SchmidMottok
(
new
UnknownStructure
(),
manager
),
//
// new Tester(new UnknownStructure(), manager), //
// new MelaniButtazzo(manager), //
new
FonsecaNelis
(
manager
),
//
new
JiangYi
(
manager
)));
// te.varyNumberOfTasks(builder, tests, 8
, 500);
//
}
//
{
// SystemManager manager = new SystemManager(8
);
// DagTaskBuilder builder = new DagTaskBuilder(
);
//
TestEnvironment te = new TestEnvironment();
te
.
varyNumberOfProcessors
(
manager
,
tests
,
500
);
}
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
manager
.
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
();
// List<AbstractTest<DagTask>> tests =
// te.registerTests(Arrays.asList(new SchmidMottok(manager),
// new MelaniButtazzo(manager), new FonsecaNelis(manager)));
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
//
// new SchmidMottok(new KnownStructure(), manager), //
new
SchmidMottok
(
new
UnknownStructure
(),
manager
),
//
// new Tester(new UnknownStructure(), manager), //
// new MelaniButtazzo(manager), //
new
FonsecaNelis
(
manager
),
//
new
JiangYi
(
manager
)));
// te.measureExecutionTimes(builder, tests, manager
, 500);
//
}
te
.
varyNumberOfTasks
(
manager
,
tests
,
500
);
}
}
}
src/main/java/mvd/jester/TestEnvironment.java
View file @
8054de06
...
...
@@ -124,7 +124,7 @@ public class TestEnvironment {
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerStep
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
().
generateUUnifastTaskSet
(
(
long
)
(
1.5
*
numberOfProcessors
),
(
double
)
numberOfProcessors
*
0.5
);
(
long
)
(
1.5
*
numberOfProcessors
),
(
double
)
numberOfProcessors
*
0.
7
5
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
...
...
@@ -166,7 +166,7 @@ public class TestEnvironment {
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerStep
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
()
.
generateUUnifastTaskSet
(
numberOfTasks
,
(
double
)
numberOfProcessors
*
0.5
);
.
generateUUnifastTaskSet
(
numberOfTasks
,
(
double
)
numberOfProcessors
*
0.
7
5
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
...
...
@@ -244,7 +244,8 @@ public class TestEnvironment {
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
resultLogger
.
logHeader
(
resultMap
,
"Utilization"
);
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
(
double
)
numberOfProcessors
/
32
)
{
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
(
double
)
numberOfProcessors
/
32
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
().
generateRenyiTaskSet
(
util
);
...
...
@@ -271,6 +272,46 @@ public class TestEnvironment {
System
.
out
.
println
(
""
);
resultLogger
.
finalize
();
}
public
void
varyPropability
(
final
SystemManager
<
DagTaskBuilder
>
manager
,
final
List
<
AbstractTest
<
DagTask
>>
abstractTestInstances
,
final
long
numberOfTaskSetsPerStep
)
{
long
checkedTasksets
=
0
;
final
long
numberOfTaskSets
=
10
*
numberOfTaskSetsPerStep
;
final
ResultLogger
resultLogger
=
new
ResultLogger
(
"valueOfPadd"
);
final
Map
<
AbstractTest
<
DagTask
>,
Long
>
resultMap
=
new
LinkedHashMap
<>();
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
resultLogger
.
logHeader
(
resultMap
,
"p_Add"
);
for
(
long
p_add
=
10
;
p_add
<=
100
;
p_add
+=
10
)
{
manager
.
setPropability
(
p_add
);
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerStep
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
().
generateRenyiTaskSet
(
5.5
);
System
.
out
.
print
(
checkedTasksets
+
"/"
+
numberOfTaskSets
+
" tasksets tested!\r"
);
for
(
final
AbstractTest
<
DagTask
>
testInstance
:
abstractTestInstances
)
{
final
PriorityManager
priorityManager
=
testInstance
.
getPriorityManager
();
final
SortedTaskSet
<
DagTask
>
sortedTaskSet
=
new
SortedTaskSet
<>(
priorityManager
);
sortedTaskSet
.
addAll
(
taskSet
);
final
SchedulingInfo
schedulingInfo
=
testInstance
.
runSchedulabilityCheck
(
sortedTaskSet
);
if
(
schedulingInfo
.
getFeasibility
()
==
Feasiblity
.
SUCCEEDED
)
{
resultMap
.
computeIfPresent
(
testInstance
,
(
k
,
v
)
->
v
+
1
);
}
}
checkedTasksets
++;
}
resultLogger
.
logLine
(
p_add
,
resultMap
);
resultLogger
.
newLine
();
}
System
.
out
.
println
(
""
);
resultLogger
.
finalize
();
}
}
src/main/java/mvd/jester/model/SystemManager.java
View file @
8054de06
...
...
@@ -45,6 +45,10 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
builder
.
setNumberOfProcessors
(
numberOfProcessors
);
}
public
void
setPropability
(
long
p_add
)
{
builder
.
setPropability
(
p_add
);
}
public
T
getBuilder
()
{
return
builder
;
}
...
...
@@ -55,6 +59,7 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
public
Builder
setNumberOfProcessors
(
long
numberOfProcessors
);
public
Builder
setPropability
(
long
p
);
}
public
static
class
SynchronousTaskBuilder
implements
Builder
{
...
...
@@ -146,6 +151,12 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
return
this
;
}
public
SynchronousTaskBuilder
setPropability
(
long
p
)
{
this
.
ratio
=
p
;
return
this
;
}
public
SynchronousTaskBuilder
setPeriods
(
final
long
minPeriod
,
final
long
maxSequentialPeriod
,
final
long
maxParallelPeriod
)
{
this
.
minPeriod
=
minPeriod
;
...
...
@@ -197,18 +208,25 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
double
currentUtilization
=
0
;
while
(
currentUtilization
<=
totalUtilization
)
{
final
DagTask
dagT
ask
=
generateRenyiTask
(
totalUtilization
);
final
DagTask
t
ask
=
generateRenyiTask
(
totalUtilization
);
if
(
currentUtilization
+
dagT
ask
.
getUtilization
()
<
totalUtilization
)
{
currentUtilization
+=
dagT
ask
.
getUtilization
();
taskSet
.
add
(
dagT
ask
);
if
(
currentUtilization
+
t
ask
.
getUtilization
()
<
totalUtilization
)
{
currentUtilization
+=
t
ask
.
getUtilization
();
taskSet
.
add
(
t
ask
);
}
else
{
final
double
remainingUtilization
=
totalUtilization
-
currentUtilization
;
final
long
period
=
(
long
)
Math
.
ceil
(
dagTask
.
getWorkload
()
/
remainingUtilization
);
if
(
period
>=
dagTask
.
getCriticalPath
())
{
final
DagTask
modifiedTask
=
new
DagTask
(
dagTask
.
getJobDag
(),
period
,
dagTask
.
getNumberOfThreads
());
final
long
period
=
(
long
)
Math
.
ceil
(
task
.
getWorkload
()
/
remainingUtilization
);
if
(
period
>=
task
.
getCriticalPath
())
{
long
numberOfThreads
=
LongMath
.
divide
(
task
.
getWorkload
()
-
task
.
getCriticalPath
(),
period
-
task
.
getCriticalPath
(),
RoundingMode
.
CEILING
);
if
(
numberOfThreads
==
0
)
{
numberOfThreads
=
1
;
}
final
DagTask
modifiedTask
=
new
DagTask
(
task
.
getJobDag
(),
period
,
numberOfThreads
);
taskSet
.
add
(
modifiedTask
);
break
;
}
...
...
@@ -227,11 +245,11 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
for
(
int
i
=
1
;
i
<=
numberOfTasks
-
1
;
i
++)
{
Double
nextSumU
=
sumU
*
Math
.
pow
(
ThreadLocalRandom
.
current
().
nextDouble
(),
(
1.0
/
(
double
)
(
numberOfTasks
-
i
)));
DagTask
task
=
generate
Task
(
sumU
-
nextSumU
);
DagTask
task
=
generate
RenyiTaskForUUniFast
(
sumU
-
nextSumU
);
taskSet
.
add
(
task
);
sumU
=
nextSumU
;
}
DagTask
task
=
generate
Task
(
sumU
);
DagTask
task
=
generate
RenyiTaskForUUniFast
(
sumU
);
taskSet
.
add
(
task
);
}
...
...
@@ -263,6 +281,33 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
return
taskSet
;
}
public
DagTask
generateRenyiTaskForUUniFast
(
final
double
utilization
)
{
final
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
jobDag
=
new
DirectedAcyclicGraph
<>(
DefaultEdge
.
class
);
final
long
numberOfVertices
=
randomNumberInRange
(
50
,
250
);
for
(
int
i
=
0
;
i
<
numberOfVertices
-
2
;
++
i
)
{
final
long
wcet
=
randomNumberInRange
(
50
,
100
);
Job
j
=
new
Job
(
wcet
);
jobDag
.
addVertex
(
j
);
}
randomEdgesRenyi
(
jobDag
);
addSourceAndSink
(
jobDag
);
final
long
workload
=
DagUtils
.
calculateWorkload
(
jobDag
);
final
long
criticalPath
=
DagUtils
.
calculateCriticalPath
(
jobDag
);
final
long
period
=
(
long
)
Math
.
ceil
(
workload
/
utilization
);
final
long
numberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
CEILING
);
if
(
numberOfThreads
==
0
)
{
return
new
DagTask
(
jobDag
,
period
,
1
);
}
return
new
DagTask
(
jobDag
,
period
,
numberOfThreads
);
}
public
DagTask
generateRenyiTask
(
final
double
totalUtilization
)
{
final
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
jobDag
=
new
DirectedAcyclicGraph
<>(
DefaultEdge
.
class
);
...
...
@@ -280,10 +325,12 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
final
long
criticalPath
=
DagUtils
.
calculateCriticalPath
(
jobDag
);
final
long
period
=
randomRenyiPeriod
(
workload
,
criticalPath
,
totalUtilization
);
// final long numberOfThreads = randomNumberOfThreads(numberOfProcessors / 2);
// TODO: Change back to above
final
long
numberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
CEILING
);
final
long
numberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
CEILING
);
if
(
numberOfThreads
==
0
)
{
return
new
DagTask
(
jobDag
,
period
,
1
);
}
return
new
DagTask
(
jobDag
,
period
,
numberOfThreads
);
}
...
...
@@ -480,6 +527,12 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
return
this
;
}
public
DagTaskBuilder
setPropability
(
long
p_add
)
{
this
.
p_add
=
p_add
;
return
this
;
}
/**
* @param maxNumberOfBranches the maxNumberOfBranches to set
*/
...
...
src/main/java/mvd/jester/model/Task.java
View file @
8054de06
...
...
@@ -7,7 +7,7 @@ public abstract class Task {
protected
final
long
deadline
;
protected
final
long
workload
;
protected
final
long
criticalPath
;
protected
final
long
numberOfThreads
;
protected
long
numberOfThreads
;
public
Task
(
final
long
period
,
final
long
deadline
,
final
long
workload
,
final
long
criticalPath
,
final
long
numberOfThreads
)
{
...
...
@@ -47,6 +47,9 @@ public abstract class Task {
return
numberOfThreads
;
}
public
void
setNumberOfThreads
(
long
numberOfThreads
)
{
this
.
numberOfThreads
=
numberOfThreads
;
}
abstract
public
long
getMaximumParallelism
();
...
...
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
8054de06
package
mvd
.
jester
.
tests
;
import
java.math.RoundingMode
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.math.LongMath
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
...
...
@@ -36,6 +38,7 @@ public class SchmidMottok extends AbstractTest<DagTask> {
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
final
SortedTaskSet
<
DagTask
>
tasks
)
{
responseTimes
.
clear
();
reassignNumberOfThreads
(
tasks
);
for
(
final
DagTask
t
:
tasks
)
{
final
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
));
...
...
@@ -49,33 +52,70 @@ public class SchmidMottok extends AbstractTest<DagTask> {
return
"SchmidMottok"
+
"_"
+
structure
.
getType
();
}
private
void
reassignNumberOfThreads
(
Set
<
DagTask
>
tasks
)
{
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
long
occupiedProcessors
=
0
;
for
(
DagTask
t
:
tasks
)
{
if
(
occupiedProcessors
>=
numberOfProcessors
)
{
t
.
setNumberOfThreads
(
numberOfProcessors
);
}
else
{
occupiedProcessors
+=
t
.
getNumberOfThreads
();
}
}
}
private
long
calculateResponseTime
(
final
Set
<
DagTask
>
tasks
,
final
DagTask
task
)
{
final
long
minimumWcet
=
task
.
getCriticalPath
();
long
responseTime
=
minimumWcet
;
long
previousResponseTime
=
0
;
final
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
long
occupiedProcessors
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
occupiedProcessors
+=
numberOfThreads
;
}
}
do
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOfThreads
;
++
p
)
{
taskInterference
+=
Math
.
min
(
structure
.
getTaskInterference
(
t
,
responseTimes
,
responseTime
,
p
+
1
),
responseTime
-
minimumWcet
+
1
);
final
double
selfInterference
=
structure
.
getSelfInterference
(
task
);
if
(
occupiedProcessors
+
structure
.
getNumberOfThreads
(
task
)
<=
numberOfProcessors
)
{
return
minimumWcet
+
(
long
)
Math
.
floor
(
selfInterference
);
}
else
{
do
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOfThreads
;
++
p
)
{
taskInterference
+=
Math
.
min
(
structure
.
getTaskInterference
(
t
,
responseTimes
,
responseTime
,
p
+
1
),
responseTime
-
minimumWcet
+
1
);
}
}
}
}
taskInterference
/=
manager
.
getNumberOfProcessors
();
final
double
selfInterference
=
structure
.
getSelfInterference
(
task
);
taskInterference
/=
numberOfProcessors
;
final
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
responseTime
=
minimumWcet
+
totalInterference
;
}
while
(
previousResponseTime
!=
responseTime
);
if
(
occupiedProcessors
<
numberOfProcessors
)
{
long
workloadAmongRemainingProcessors
=
LongMath
.
divide
(
task
.
getWorkload
()
-
task
.
getCriticalPath
(),
numberOfProcessors
-
occupiedProcessors
,
RoundingMode
.
FLOOR
);
totalInterference
=
Math
.
min
(
totalInterference
,
workloadAmongRemainingProcessors
);
}
return
responseTim
e
;
}
responseTime
=
minimumWcet
+
totalInterferenc
e
;
}
while
(
previousResponseTime
!=
responseTime
);
return
responseTime
;
}
}
}
src/main/java/mvd/jester/tests/Tester.java
View file @
8054de06
package
mvd
.
jester
.
tests
;
import
java.math.RoundingMode
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.math.LongMath
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
...
...
@@ -29,6 +31,7 @@ public class Tester extends AbstractTest<DagTask> {
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
SortedTaskSet
<
DagTask
>
tasks
)
{
responseTimes
.
clear
();
assignNumberOfThreads
(
tasks
);
for
(
final
DagTask
t
:
tasks
)
{
final
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
));
...
...
@@ -42,6 +45,27 @@ public class Tester extends AbstractTest<DagTask> {
return
priorityManager
;
}
private
void
assignNumberOfThreads
(
Set
<
DagTask
>
tasks
)
{
long
occupiedProcessors
=
0
;
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
for
(
DagTask
t
:
tasks
)
{
long
workload
=
t
.
getWorkload
();
long
criticalPath
=
t
.
getCriticalPath
();
long
period
=
t
.
getPeriod
();
if
(
period
==
criticalPath
)
{
t
.
setNumberOfThreads
(
1
);
}
else
if
(
occupiedProcessors
>=
numberOfProcessors
)
{
t
.
setNumberOfThreads
(
numberOfProcessors
);
}
else
{
final
long
numberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
CEILING
);
t
.
setNumberOfThreads
(
numberOfThreads
);
occupiedProcessors
+=
numberOfThreads
;
}
}
}
@Override
public
String
getName
()
{
return
"Tester_"
+
structure
.
getType
();
...
...
@@ -51,24 +75,28 @@ public class Tester extends AbstractTest<DagTask> {
final
long
minimumWcet
=
task
.
getCriticalPath
();
long
responseTime
=
minimumWcet
;
long
previousResponseTime
=
0
;
final
long
numberOfProcessors
=
manager
.
getNumberOfProcessors
();
long
currentNumberOfThread
s
=
0
;
long
occupiedProcessor
s
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
currentNumberOfThread
s
+=
numberOfThreads
;
occupiedProcessor
s
+=
numberOfThreads
;
}
}
do
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
if
(
currentNumberOfThreads
+
structure
.
getNumberOfThreads
(
task
)
>
manager
.
getNumberOfProcessors
())
{
final
double
selfInterference
=
structure
.
getSelfInterference
(
task
);
if
(
occupiedProcessors
+
structure
.
getNumberOfThreads
(
task
)
<=
numberOfProcessors
)
{
return
minimumWcet
+
(
long
)
Math
.
floor
(
selfInterference
);
}
else
{
do
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOfThreads
;
++
p
)
{
taskInterference
+=
Math
.
min
(
...
...
@@ -79,15 +107,22 @@ public class Tester extends AbstractTest<DagTask> {
}
}
taskInterference
/=
manager
.
getNumberOfProcessors
();
}
final
double
selfInterference
=
structure
.
getSelfInterference
(
task
);
taskInterference
/=
numberOfProcessors
;
final
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
responseTime
=
minimumWcet
+
totalInterference
;
}
while
(
previousResponseTime
!=
responseTime
);
if
(
occupiedProcessors
<
numberOfProcessors
)
{
long
workloadAmongRemainingProcessors
=
LongMath
.
divide
(
task
.
getWorkload
()
-
task
.
getCriticalPath
(),
numberOfProcessors
-
occupiedProcessors
,
RoundingMode
.
FLOOR
);
totalInterference
=
Math
.
min
(
totalInterference
,
workloadAmongRemainingProcessors
);
}
responseTime
=
minimumWcet
+
totalInterference
;
}
while
(
previousResponseTime
!=
responseTime
);
return
responseTime
;
return
responseTime
;
}
}
}
src/main/java/mvd/jester/tests/TypeFunction.java
View file @
8054de06
...
...
@@ -79,7 +79,7 @@ public interface TypeFunction {
}
}
public
class
UnkownStructure
implements
TypeFunction
{
public
class
Unk
n
ownStructure
implements
TypeFunction
{
@Override
public
double
getTaskInterference
(
final
DagTask
task
,
...
...
src/test/java/mvd/jester/priority/TestRateMonotonic.java
View file @
8054de06
...
...
@@ -58,7 +58,7 @@ public class TestRateMonotonic {
assertTrue
(
rm
.
hasSimulator
(
DynamicForkJoin
.
class
));
assertFalse
(
rm
.
hasTest
(
new
ChwaLee
(
manager
)));
assertTrue
(
rm
.
hasTest
(
new
SchmidMottok
(
new
TypeFunction
.
UnkownStructure
(),
manager
)));
assertTrue
(
rm
.
hasTest
(
new
SchmidMottok
(
new
TypeFunction
.
Unk
n
ownStructure
(),
manager
)));
assertTrue
(
rm
.
hasTest
(
new
MaiaBertogna
(
manager
)));
// assertTrue(rm.hasSimulator(new ParallelSynchronous(mock(SystemSetup.class))));
// assertTrue(rm.hasSimulator(new DynamicForkJoin(mock(SystemSetup.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