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
dbeac016
authored
Jun 03, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fonseca test now works as well
parent
75736ee6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
102 deletions
+24
-102
src/main/java/mvd/jester/App.java
+5
-5
src/main/java/mvd/jester/TestEnvironment.java
+3
-9
src/main/java/mvd/jester/model/SystemSetup.java
+1
-1
src/main/java/mvd/jester/tests/FonsecaNelis.java
+15
-87
No files found.
src/main/java/mvd/jester/App.java
View file @
dbeac016
...
@@ -6,6 +6,8 @@ import mvd.jester.model.DagTask;
...
@@ -6,6 +6,8 @@ import mvd.jester.model.DagTask;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.tests.FonsecaNelis
;
import
mvd.jester.tests.FonsecaNelis
;
import
mvd.jester.tests.MelaniButtazzo
;
import
mvd.jester.tests.SchmidMottok
;
/**
/**
...
@@ -19,12 +21,10 @@ public class App {
...
@@ -19,12 +21,10 @@ public class App {
new
SystemSetup
.
DagTaskBuilder
().
setNumberOfProcessors
(
p
);
new
SystemSetup
.
DagTaskBuilder
().
setNumberOfProcessors
(
p
);
TestEnvironment
te
=
new
TestEnvironment
();
TestEnvironment
te
=
new
TestEnvironment
();
List
<
AbstractTest
<
DagTask
>>
tests
=
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
new
SchmidMottok
(
p
),
te
.
registerTests
(
Arrays
.
asList
(
/*
/* new MelaniButtazzo(p), */
new
FonsecaNelis
(
p
)));
* new SchmidMottok(p), new MelaniButtazzo(p) ,
*/
new
FonsecaNelis
(
p
)));
te
.
runExperiments
(
builder
,
tests
,
p
,
100
);
te
.
runExperiments
(
builder
,
tests
,
p
,
100
);
// TODO: Change back to 500
}
}
}
}
}
}
src/main/java/mvd/jester/TestEnvironment.java
View file @
dbeac016
...
@@ -91,7 +91,7 @@ public class TestEnvironment {
...
@@ -91,7 +91,7 @@ public class TestEnvironment {
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
nextTry:
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
builder
.
generateTaskSet
(
util
);
final
Set
<
DagTask
>
taskSet
=
builder
.
generateTaskSet
(
util
);
System
.
out
.
print
(
Math
.
round
((
double
)
checkedTasksets
/
numberOfTaskSets
*
100
)
System
.
out
.
print
(
Math
.
round
((
double
)
checkedTasksets
/
numberOfTaskSets
*
100
)
...
@@ -102,14 +102,8 @@ public class TestEnvironment {
...
@@ -102,14 +102,8 @@ public class TestEnvironment {
final
SortedTaskSet
<
DagTask
>
sortedTaskSet
=
final
SortedTaskSet
<
DagTask
>
sortedTaskSet
=
new
SortedTaskSet
<>(
priorityManager
);
new
SortedTaskSet
<>(
priorityManager
);
sortedTaskSet
.
addAll
(
taskSet
);
sortedTaskSet
.
addAll
(
taskSet
);
final
SchedulingInfo
schedulingInfo
;
final
SchedulingInfo
schedulingInfo
=
try
{
testInstance
.
runSchedulabilityCheck
(
sortedTaskSet
);
schedulingInfo
=
testInstance
.
runSchedulabilityCheck
(
sortedTaskSet
);
}
catch
(
Exception
e
)
{
i
--;
continue
nextTry
;
// TODO: remove this exception
}
if
(
schedulingInfo
.
getFeasibility
()
==
Feasiblity
.
SUCCEEDED
)
{
if
(
schedulingInfo
.
getFeasibility
()
==
Feasiblity
.
SUCCEEDED
)
{
resultMap
.
computeIfPresent
(
testInstance
,
(
k
,
v
)
->
v
+
1
);
resultMap
.
computeIfPresent
(
testInstance
,
(
k
,
v
)
->
v
+
1
);
...
...
src/main/java/mvd/jester/model/SystemSetup.java
View file @
dbeac016
...
@@ -209,7 +209,7 @@ public class SystemSetup<T extends Task> {
...
@@ -209,7 +209,7 @@ public class SystemSetup<T extends Task> {
private
long
maxNumberOfBranches
=
5
;
private
long
maxNumberOfBranches
=
5
;
private
long
depth
=
2
;
private
long
depth
=
2
;
private
long
p_par
=
80
;
private
long
p_par
=
80
;
private
long
p_add
=
20
;
private
long
p_add
=
5
;
// TODO: Change back to 20
public
DagTaskBuilder
()
{
public
DagTaskBuilder
()
{
}
}
...
...
src/main/java/mvd/jester/tests/FonsecaNelis.java
View file @
dbeac016
...
@@ -13,7 +13,6 @@ import java.util.Set;
...
@@ -13,7 +13,6 @@ import java.util.Set;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
com.google.common.math.LongMath
;
import
com.google.common.math.LongMath
;
import
org.jgrapht.Graphs
;
import
org.jgrapht.experimental.dag.DirectedAcyclicGraph
;
import
org.jgrapht.experimental.dag.DirectedAcyclicGraph
;
import
org.jgrapht.graph.DefaultEdge
;
import
org.jgrapht.graph.DefaultEdge
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.SchedulingInfo
;
...
@@ -35,13 +34,13 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -35,13 +34,13 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
private
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
private
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
private
final
PriorityManager
priorityManager
;
private
final
PriorityManager
priorityManager
;
private
final
Map
<
Task
,
Set
<
Segment
>>
sorted
Segments
;
private
final
Map
<
Task
,
Set
<
Segment
>>
carryOut
Segments
;
public
FonsecaNelis
(
final
long
numberOfProcessors
)
{
public
FonsecaNelis
(
final
long
numberOfProcessors
)
{
super
(
numberOfProcessors
);
super
(
numberOfProcessors
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
this
.
priorityManager
=
new
RateMonotonic
();
this
.
sorted
Segments
=
new
HashMap
<>();
this
.
carryOut
Segments
=
new
HashMap
<>();
}
}
@Override
@Override
...
@@ -51,7 +50,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -51,7 +50,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
@Override
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
final
SortedTaskSet
<
DagTask
>
tasks
)
{
public
SchedulingInfo
runSchedulabilityCheck
(
final
SortedTaskSet
<
DagTask
>
tasks
)
{
sorted
Segments
.
clear
();
carryOut
Segments
.
clear
();
responseTimes
.
clear
();
responseTimes
.
clear
();
createNFJandDecompositionTree
(
tasks
);
createNFJandDecompositionTree
(
tasks
);
for
(
final
DagTask
t
:
tasks
)
{
for
(
final
DagTask
t
:
tasks
)
{
...
@@ -69,78 +68,9 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -69,78 +68,9 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
nfjJobDag
=
final
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
nfjJobDag
=
DagUtils
.
createNFJGraph
(
jobDag
);
DagUtils
.
createNFJGraph
(
jobDag
);
final
BinaryDecompositionTree
<
Job
>
tree
=
DagUtils
.
createDecompositionTree
(
nfjJobDag
);
final
BinaryDecompositionTree
<
Job
>
tree
=
DagUtils
.
createDecompositionTree
(
nfjJobDag
);
// TODO: remove this
if
(!
DagUtils
.
checkNFJProperty
(
nfjJobDag
)
||
!
checkTree
(
nfjJobDag
,
tree
))
{
throw
new
RuntimeException
(
"Nicht NFJ in Test!"
);
}
sortedSegments
.
put
(
t
,
constructCarryOutDistribution
(
nfjJobDag
,
tree
));
}
}
// TODO: Remove this function
private
boolean
checkTree
(
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
nfjJobDag
,
BinaryDecompositionTree
<
Job
>
tree
)
{
DirectedAcyclicGraph
<
Job
,
DefaultEdge
>
jobDagFromTree
=
DagUtils
.
createNFJfromDecompositionTree
(
tree
);
if
(
nfjJobDag
.
vertexSet
().
size
()
!=
jobDagFromTree
.
vertexSet
().
size
())
{
return
false
;
}
if
(
jobDagFromTree
.
edgeSet
().
size
()
!=
nfjJobDag
.
edgeSet
().
size
())
{
return
false
;
}
for
(
DefaultEdge
e
:
nfjJobDag
.
edgeSet
())
{
Job
target
=
nfjJobDag
.
getEdgeTarget
(
e
);
Job
source
=
nfjJobDag
.
getEdgeSource
(
e
);
if
(!
jobDagFromTree
.
containsEdge
(
source
,
target
))
{
return
false
;
}
}
for
(
Job
j
:
nfjJobDag
)
{
for
(
Job
n
:
nfjJobDag
)
{
if
(
n
==
j
)
{
continue
;
}
if
(
nfjJobDag
.
containsEdge
(
n
,
j
)
&&
!
jobDagFromTree
.
containsEdge
(
n
,
j
))
{
return
false
;
}
}
if
(
nfjJobDag
.
inDegreeOf
(
j
)
!=
jobDagFromTree
.
inDegreeOf
(
j
))
return
false
;
if
(
nfjJobDag
.
outDegreeOf
(
j
)
!=
jobDagFromTree
.
outDegreeOf
(
j
))
return
false
;
for
(
Job
p
:
Graphs
.
predecessorListOf
(
nfjJobDag
,
j
))
{
if
(!
Graphs
.
predecessorListOf
(
jobDagFromTree
,
j
).
contains
(
p
))
{
return
false
;
}
}
for
(
Job
s
:
Graphs
.
successorListOf
(
nfjJobDag
,
j
))
{
if
(!
Graphs
.
successorListOf
(
jobDagFromTree
,
j
).
contains
(
s
))
{
return
false
;
}
}
for
(
Job
a
:
nfjJobDag
.
getAncestors
(
nfjJobDag
,
j
))
{
carryOutSegments
.
put
(
t
,
constructCarryOutDistribution
(
nfjJobDag
,
tree
));
if
(!
jobDagFromTree
.
getAncestors
(
jobDagFromTree
,
j
).
contains
(
a
))
{
return
false
;
}
}
for
(
Job
d
:
nfjJobDag
.
getDescendants
(
nfjJobDag
,
j
))
{
if
(!
jobDagFromTree
.
getDescendants
(
jobDagFromTree
,
j
).
contains
(
d
))
{
return
false
;
}
}
}
}
return
true
;
}
}
private
Set
<
Segment
>
constructCarryOutDistribution
(
private
Set
<
Segment
>
constructCarryOutDistribution
(
...
@@ -182,7 +112,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -182,7 +112,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
if
(
node
.
getNodeType
().
equals
(
NodeType
.
LEAF
))
{
if
(
node
.
getNodeType
().
equals
(
NodeType
.
LEAF
))
{
return
new
Node
<
TreeJob
>(
parent
,
new
TreeJob
(
node
.
getObject
()));
return
new
Node
<
TreeJob
>(
parent
,
new
TreeJob
(
node
.
getObject
()));
}
else
{
}
else
{
final
Node
<
TreeJob
>
modifiedNode
=
new
Node
<
TreeJob
>(
null
,
node
.
getNodeType
());
final
Node
<
TreeJob
>
modifiedNode
=
new
Node
<
TreeJob
>(
parent
,
node
.
getNodeType
());
modifiedNode
.
setLeftNode
(
transformNode
(
modifiedNode
,
node
.
getLeftNode
()));
modifiedNode
.
setLeftNode
(
transformNode
(
modifiedNode
,
node
.
getLeftNode
()));
modifiedNode
.
setRightNode
(
transformNode
(
modifiedNode
,
node
.
getRightNode
()));
modifiedNode
.
setRightNode
(
transformNode
(
modifiedNode
,
node
.
getRightNode
()));
return
modifiedNode
;
return
modifiedNode
;
...
@@ -233,10 +163,6 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -233,10 +163,6 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
final
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
responseTime
=
criticalPath
+
totalInterference
;
responseTime
=
criticalPath
+
totalInterference
;
// TODO: remove check of deadline if bug is found
if
(
responseTime
>
task
.
getDeadline
())
{
return
responseTime
;
}
}
while
(
responseTime
!=
previousResponseTime
);
}
while
(
responseTime
!=
previousResponseTime
);
return
responseTime
;
return
responseTime
;
...
@@ -245,9 +171,9 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -245,9 +171,9 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
private
double
getTaskInterference
(
final
DagTask
task
,
final
long
interval
)
{
private
double
getTaskInterference
(
final
DagTask
task
,
final
long
interval
)
{
final
long
period
=
task
.
getPeriod
();
final
long
period
=
task
.
getPeriod
();
final
long
criticalPath
=
task
.
getCriticalPath
();
final
long
criticalPath
=
task
.
getCriticalPath
();
final
long
numberOf
Interval
s
=
final
long
numberOf
Period
s
=
LongMath
.
divide
(
interval
-
criticalPath
,
period
,
RoundingMode
.
FLOOR
);
LongMath
.
divide
(
interval
-
criticalPath
,
period
,
RoundingMode
.
FLOOR
);
final
long
carryInAndOutInterval
=
interval
-
Math
.
max
(
0
,
numberOf
Interval
s
)
*
period
;
final
long
carryInAndOutInterval
=
interval
-
Math
.
max
(
0
,
numberOf
Period
s
)
*
period
;
final
long
numberOfBodyJobs
=
final
long
numberOfBodyJobs
=
LongMath
.
divide
(
interval
-
carryInAndOutInterval
,
period
,
RoundingMode
.
FLOOR
);
LongMath
.
divide
(
interval
-
carryInAndOutInterval
,
period
,
RoundingMode
.
FLOOR
);
...
@@ -255,7 +181,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -255,7 +181,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final
long
carryInAndOutWorkload
=
getCarryInAndOutWorkload
(
task
,
final
long
carryInAndOutWorkload
=
getCarryInAndOutWorkload
(
task
,
task
.
getWorkloadDistribution
(),
sorted
Segments
.
get
(
task
),
carryInAndOutInterval
);
task
.
getWorkloadDistribution
(),
carryOut
Segments
.
get
(
task
),
carryInAndOutInterval
);
return
carryInAndOutWorkload
+
bodyWorkload
;
return
carryInAndOutWorkload
+
bodyWorkload
;
}
}
...
@@ -299,8 +225,8 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -299,8 +225,8 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
private
long
getCarryOutWorkload
(
final
DagTask
task
,
final
Set
<
Segment
>
carryOutDistribution
,
private
long
getCarryOutWorkload
(
final
DagTask
task
,
final
Set
<
Segment
>
carryOutDistribution
,
final
long
carryOutPeriod
)
{
final
long
carryOutPeriod
)
{
long
workload
=
0
;
long
workload
=
0
;
final
long
period
=
task
.
getPerio
d
();
final
long
taskWorkload
=
task
.
getWorkloa
d
();
final
long
responseTime
=
responseTimes
.
get
(
task
).
getResponseTime
();
final
long
criticalPath
=
task
.
getCriticalPath
();
final
List
<
Segment
>
distributionList
=
Lists
.
newArrayList
(
carryOutDistribution
);
final
List
<
Segment
>
distributionList
=
Lists
.
newArrayList
(
carryOutDistribution
);
for
(
int
i
=
0
;
i
<
distributionList
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
distributionList
.
size
();
++
i
)
{
...
@@ -314,10 +240,12 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
...
@@ -314,10 +240,12 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
getJobWcet
()),
0
)
*
s
.
getNumberOfJobs
();
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
getJobWcet
()),
0
)
*
s
.
getNumberOfJobs
();
}
}
final
long
improvedWorkload
=
final
long
improvedWorkloadFromTask
=
Math
.
max
(
carryOutPeriod
-
(
period
-
responseTime
),
0
)
*
numberOfProcessors
;
taskWorkload
-
Math
.
max
(
0
,
criticalPath
-
carryOutPeriod
);
final
long
improvedWorkloadFromProcessors
=
carryOutPeriod
*
numberOfProcessors
;
return
Math
.
min
(
improvedWorkload
,
workload
);
return
Math
.
min
(
Math
.
min
(
improvedWorkloadFromTask
,
improvedWorkloadFromProcessors
),
workload
);
}
}
private
long
getCarryInWorkload
(
final
DagTask
task
,
final
Set
<
Segment
>
carryInDistribution
,
private
long
getCarryInWorkload
(
final
DagTask
task
,
final
Set
<
Segment
>
carryInDistribution
,
...
...
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