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
43947796
authored
Sep 25, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small changes, mostly renaming
parent
39635336
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
94 additions
and
102 deletions
+94
-102
.project
+11
-0
src/main/java/mvd/jester/App.java
+12
-11
src/main/java/mvd/jester/TestEnvironment.java
+2
-1
src/main/java/mvd/jester/model/DagTask.java
+2
-2
src/main/java/mvd/jester/model/Segment.java
+9
-9
src/main/java/mvd/jester/model/SynchronousTask.java
+4
-4
src/main/java/mvd/jester/model/SystemManager.java
+6
-11
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/JobContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/SegmentContext.java
+2
-2
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/JobContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/SegmentContext.java
+2
-2
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/TaskContext.java
+1
-1
src/main/java/mvd/jester/tests/ChwaLee.java
+10
-10
src/main/java/mvd/jester/tests/FonsecaNelis.java
+6
-6
src/main/java/mvd/jester/tests/MaiaBertogna.java
+5
-5
src/main/java/mvd/jester/tests/SchmidMottok.java
+3
-15
src/main/java/mvd/jester/tests/TypeFunction.java
+5
-9
src/test/java/mvd/jester/model/TestSegment.java
+4
-4
src/test/java/mvd/jester/model/TestSystemSetup.java
+4
-4
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestJobContext.java
+3
-3
src/test/java/mvd/jester/simulator/parallelsynchronous/TestJobContext.java
+1
-1
No files found.
.project
View file @
43947796
...
...
@@ -20,4 +20,15 @@
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.eclipse.m2e.core.maven2Nature
</nature>
</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>
src/main/java/mvd/jester/App.java
View file @
43947796
...
...
@@ -30,7 +30,7 @@ public class App {
// SchmidMottok sm = new SchmidMottok(new KnownStructure(), 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());
// rmTasks.addAll(set);
...
...
@@ -45,10 +45,10 @@ public class App {
new
SchmidMottok
(
new
KnownStructureWithMaxThreads
(
manager
),
manager
),
new
SchmidMottok
(
new
KnownStructure
(),
manager
),
// new MelaniButtazzo(manager),
// new FonsecaNelis(manager),
new
JiangYi
(
manager
)
));
new
FonsecaNelis
(
manager
)
/* new JiangYi(manager) */
));
te
.
varyRenyiUtilization
(
manager
,
tests
,
5
00
);
te
.
varyRenyiUtilization
(
manager
,
tests
,
1
00
);
}
// {
// SystemManager manager = new SystemManager(8);
...
...
@@ -65,16 +65,17 @@ public class App {
// te.varyUtilization(builder, tests, 8, 500);
// }
// {
// SystemManager manager = new SystemManager(8);
// DagTaskBuilder builder = new DagTaskBuilder();
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// 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 KnownStructureWithMaxThreads(manager), manager),
// new SchmidMottok(new KnownStructure(), 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);
...
...
src/main/java/mvd/jester/TestEnvironment.java
View file @
43947796
...
...
@@ -238,7 +238,8 @@ public class TestEnvironment {
long
checkedTasksets
=
0
;
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
<>();
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
resultLogger
.
logHeader
(
resultMap
,
"Utilization"
);
...
...
src/main/java/mvd/jester/model/DagTask.java
View file @
43947796
...
...
@@ -54,8 +54,8 @@ public class DagTask extends Task {
public
long
getMaximumParallelism
()
{
long
max
=
0
;
for
(
final
Segment
s
:
workloadDistribution
)
{
if
(
max
<
s
.
get
NumberOfJobs
())
{
max
=
s
.
get
NumberOfJobs
();
if
(
max
<
s
.
get
Height
())
{
max
=
s
.
get
Height
();
}
}
return
max
;
...
...
src/main/java/mvd/jester/model/Segment.java
View file @
43947796
...
...
@@ -3,26 +3,26 @@ package mvd.jester.model;
public
class
Segment
{
private
final
long
jobWcet
;
private
final
long
numberOfJobs
;
private
final
long
width
;
private
final
long
height
;
public
Segment
(
long
jobWcet
,
long
numberOfJobs
)
{
this
.
jobWcet
=
jobWcet
;
this
.
numberOfJobs
=
numberOfJobs
;
public
Segment
(
long
width
,
long
height
)
{
this
.
width
=
width
;
this
.
height
=
height
;
}
/**
* @return the numberOfJobs
*/
public
long
get
NumberOfJobs
()
{
return
numberOfJobs
;
public
long
get
Height
()
{
return
height
;
}
/**
* @return the jobWcet
*/
public
long
get
JobWcet
()
{
return
jobWcet
;
public
long
get
Width
()
{
return
width
;
}
}
src/main/java/mvd/jester/model/SynchronousTask.java
View file @
43947796
...
...
@@ -64,8 +64,8 @@ public class SynchronousTask extends Task {
public
long
getMaximumParallelism
()
{
long
max
=
0
;
for
(
final
Segment
s
:
segments
)
{
if
(
max
<
s
.
get
NumberOfJobs
())
{
max
=
s
.
get
NumberOfJobs
();
if
(
max
<
s
.
get
Height
())
{
max
=
s
.
get
Height
();
}
}
return
max
;
...
...
@@ -80,7 +80,7 @@ public class SynchronousTask extends Task {
public
static
long
calculateWorkload
(
final
Set
<
Segment
>
segments
)
{
long
workload
=
0
;
for
(
final
Segment
s
:
segments
)
{
workload
+=
s
.
get
JobWcet
()
*
s
.
getNumberOfJobs
();
workload
+=
s
.
get
Width
()
*
s
.
getHeight
();
}
return
workload
;
}
...
...
@@ -89,7 +89,7 @@ public class SynchronousTask extends Task {
public
static
long
calculateCriticalPath
(
final
Set
<
Segment
>
segments
)
{
long
criticalPath
=
0
;
for
(
final
Segment
s
:
segments
)
{
criticalPath
+=
s
.
get
JobWcet
();
criticalPath
+=
s
.
get
Width
();
}
return
criticalPath
;
...
...
src/main/java/mvd/jester/model/SystemManager.java
View file @
43947796
...
...
@@ -194,8 +194,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
public
Set
<
DagTask
>
generateRenyiTaskSet
(
final
double
totalUtilization
)
{
final
LinkedHashSet
<
DagTask
>
taskSet
=
new
LinkedHashSet
<>();
double
currentUtilization
=
0
;
while
(
currentUtilization
<=
totalUtilization
)
{
final
DagTask
dagTask
=
generateRenyiTask
(
totalUtilization
);
...
...
@@ -207,8 +207,8 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
final
long
period
=
(
long
)
Math
.
ceil
(
dagTask
.
getWorkload
()
/
remainingUtilization
);
if
(
period
>=
dagTask
.
getCriticalPath
())
{
final
DagTask
modifiedTask
=
new
DagTask
(
dagTask
.
getJobDag
(),
period
,
numberOfProcessors
);
final
DagTask
modifiedTask
=
new
DagTask
(
dagTask
.
getJobDag
(),
period
,
dagTask
.
getNumberOfThreads
()
);
taskSet
.
add
(
modifiedTask
);
break
;
}
...
...
@@ -280,19 +280,14 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
final
long
criticalPath
=
DagUtils
.
calculateCriticalPath
(
jobDag
);
final
long
period
=
randomRenyiPeriod
(
workload
,
criticalPath
,
totalUtilization
);
final
long
minNumberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
FLOOR
);
// TODO: change back to following:
// final long numberOfThreads = randomNumberOfThreads(minNumberOfThreads);
final
long
numberOfThreads
=
randomNumberOfThreads
(
numberOfProcessors
/
2
);
return
new
DagTask
(
jobDag
,
period
,
minN
umberOfThreads
);
return
new
DagTask
(
jobDag
,
period
,
n
umberOfThreads
);
}
private
long
randomRenyiPeriod
(
final
long
workload
,
final
long
criticalPath
,
final
double
totalUtilization
)
{
final
double
firstPart
=
(
criticalPath
+
(
double
)
(
workload
)
/
(
0.4
*
totalUtilization
));
final
double
firstPart
=
(
criticalPath
+
(
double
)
(
workload
)
/
(
0.4
*
totalUtilization
));
final
double
gamma
=
new
GammaDistribution
(
2
,
1
).
sample
();
final
double
secondPart
=
1
+
0.25
*
gamma
;
...
...
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/JobContext.java
View file @
43947796
...
...
@@ -25,7 +25,7 @@ public class JobContext implements JobContextInterface {
this
.
currentTasklet
=
Optional
.
empty
();
this
.
taskContext
=
taskContext
;
this
.
segmentContext
=
segmentContext
;
this
.
wcet
=
segmentContext
.
getSegment
().
get
JobWcet
();
this
.
wcet
=
segmentContext
.
getSegment
().
get
Width
();
}
public
Optional
<
TaskContextInterface
>
updateExecution
(
long
time
)
{
...
...
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/SegmentContext.java
View file @
43947796
...
...
@@ -19,8 +19,8 @@ public class SegmentContext {
jobs
=
new
HashSet
<>();
tasklets
=
new
HashSet
<>();
long
numberOfJobs
=
segment
.
getNumberOfJobs
()
>
numberOfProcessors
?
numberOfProcessors
:
segment
.
getNumberOfJobs
();
long
numberOfJobs
=
segment
.
getHeight
()
>
numberOfProcessors
?
numberOfProcessors
:
segment
.
getHeight
();
for
(
int
j
=
0
;
j
<
numberOfJobs
;
++
j
)
{
jobs
.
add
(
new
JobContext
(
taskContext
,
this
));
...
...
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/JobContext.java
View file @
43947796
...
...
@@ -24,7 +24,7 @@ public class JobContext implements JobContextInterface {
this
.
currentProcessor
=
Optional
.
empty
();
this
.
taskContext
=
taskContext
;
this
.
segmentContext
=
segmentContext
;
this
.
wcet
=
segmentContext
.
getSegment
().
get
JobWcet
();
this
.
wcet
=
segmentContext
.
getSegment
().
get
Width
();
this
.
executionTime
=
wcet
;
}
...
...
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/SegmentContext.java
View file @
43947796
...
...
@@ -17,7 +17,7 @@ public class SegmentContext {
this
.
segment
=
segment
;
jobs
=
new
HashSet
<>();
for
(
int
j
=
0
;
j
<
segment
.
get
NumberOfJobs
();
++
j
)
{
for
(
int
j
=
0
;
j
<
segment
.
get
Height
();
++
j
)
{
jobs
.
add
(
new
JobContext
(
taskContext
,
this
));
}
}
...
...
@@ -38,6 +38,6 @@ public class SegmentContext {
@Override
public
String
toString
()
{
return
"(nJobs="
+
segment
.
get
NumberOfJobs
()
+
", jobWcet="
+
segment
.
getJobWcet
()
+
")"
;
return
"(nJobs="
+
segment
.
get
Height
()
+
", jobWcet="
+
segment
.
getWidth
()
+
")"
;
}
}
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/TaskContext.java
View file @
43947796
...
...
@@ -56,7 +56,7 @@ public class TaskContext implements TaskContextInterface {
public
Optional
<
TaskContextInterface
>
acceptNotification
(
long
time
)
{
segmentCounter
++;
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
get
NumberOfJobs
())
{
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
get
Height
())
{
currentSegment
++;
segmentCounter
=
0
;
if
(
currentSegment
>=
segments
.
size
())
{
...
...
src/main/java/mvd/jester/tests/ChwaLee.java
View file @
43947796
...
...
@@ -84,8 +84,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
long
selfInterference
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
if
(
s
.
get
NumberOfJobs
()
>=
p
+
1
)
{
selfInterference
+=
s
.
get
JobWcet
();
if
(
s
.
get
Height
()
>=
p
+
1
)
{
selfInterference
+=
s
.
get
Width
();
}
}
return
selfInterference
;
...
...
@@ -97,8 +97,8 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
long
workloadOfBodyJobs
=
0
;
for
(
final
Segment
s
:
t
.
getWorkloadDistribution
())
{
if
(
s
.
get
NumberOfJobs
()
>=
p
)
{
workloadOfBodyJobs
+=
s
.
get
JobWcet
();
if
(
s
.
get
Height
()
>=
p
)
{
workloadOfBodyJobs
+=
s
.
get
Width
();
}
}
...
...
@@ -109,11 +109,11 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
final
List
<
Segment
>
segmentList
=
new
ArrayList
<>(
t
.
getWorkloadDistribution
());
Collections
.
reverse
(
segmentList
);
for
(
final
Segment
s
:
segmentList
)
{
carryInLength
+=
s
.
get
JobWcet
();
if
(
s
.
get
NumberOfJobs
()
>=
p
&&
remainingLength
>
carryInLength
)
{
boundedCarryInWorkload
+=
s
.
get
JobWcet
();
}
else
if
(
s
.
get
NumberOfJobs
()
>=
p
&&
remainingLength
<=
carryInLength
)
{
boundedCarryInWorkload
+=
s
.
get
JobWcet
()
-
(
carryInLength
-
remainingLength
);
carryInLength
+=
s
.
get
Width
();
if
(
s
.
get
Height
()
>=
p
&&
remainingLength
>
carryInLength
)
{
boundedCarryInWorkload
+=
s
.
get
Width
();
}
else
if
(
s
.
get
Height
()
>=
p
&&
remainingLength
<=
carryInLength
)
{
boundedCarryInWorkload
+=
s
.
get
Width
()
-
(
carryInLength
-
remainingLength
);
}
if
(
carryInLength
>=
remainingLength
)
{
break
;
...
...
@@ -126,7 +126,7 @@ public class ChwaLee extends AbstractTest<SynchronousTask> {
private
long
getMinimumWcet
(
final
SynchronousTask
task
)
{
long
minWcet
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
minWcet
+=
s
.
get
JobWcet
();
minWcet
+=
s
.
get
Width
();
}
return
minWcet
;
...
...
src/main/java/mvd/jester/tests/FonsecaNelis.java
View file @
43947796
...
...
@@ -198,7 +198,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
Collections
.
reverse
(
reverseCarryInList
);
for
(
final
Segment
s
:
reverseCarryInList
)
{
carryInPeriod
+=
s
.
get
JobWcet
();
carryInPeriod
+=
s
.
get
Width
();
carryOutPeriod
=
carryInAndOutPeriod
-
carryInPeriod
;
final
long
carryInWorkload
=
getCarryInWorkload
(
task
,
carryInDistribution
,
carryInPeriod
);
...
...
@@ -212,7 +212,7 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
carryOutPeriod
=
0
;
for
(
final
Segment
s
:
carryOutDistribution
)
{
carryOutPeriod
+=
s
.
get
JobWcet
();
carryOutPeriod
+=
s
.
get
Width
();
carryInPeriod
=
carryInAndOutPeriod
-
carryOutPeriod
;
final
long
carryInWorkload
=
getCarryInWorkload
(
task
,
carryInDistribution
,
carryInPeriod
);
...
...
@@ -235,11 +235,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final
Segment
s
=
distributionList
.
get
(
i
);
long
weightOfPreviousSegments
=
0
;
for
(
int
j
=
0
;
j
<
i
;
++
j
)
{
weightOfPreviousSegments
+=
distributionList
.
get
(
j
).
get
JobWcet
();
weightOfPreviousSegments
+=
distributionList
.
get
(
j
).
get
Width
();
}
final
long
width
=
carryOutPeriod
-
weightOfPreviousSegments
;
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
get
JobWcet
()),
0
)
*
s
.
getNumberOfJobs
();
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
get
Width
()),
0
)
*
s
.
getHeight
();
}
final
long
improvedWorkloadFromTask
=
...
...
@@ -262,11 +262,11 @@ public class FonsecaNelis extends AbstractTest<DagTask> {
final
Segment
s
=
distributionList
.
get
(
b
);
long
weightOfRemainingSegments
=
0
;
for
(
int
p
=
b
+
1
;
p
<
carryInDistribution
.
size
();
++
p
)
{
weightOfRemainingSegments
+=
distributionList
.
get
(
p
).
get
JobWcet
();
weightOfRemainingSegments
+=
distributionList
.
get
(
p
).
get
Width
();
}
final
long
width
=
carryInPeriod
-
period
+
responseTime
-
weightOfRemainingSegments
;
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
get
JobWcet
()),
0
)
*
s
.
getNumberOfJobs
();
workload
+=
Math
.
max
(
Math
.
min
(
width
,
s
.
get
Width
()),
0
)
*
s
.
getHeight
();
}
final
long
improvedWorkload
=
Math
.
max
(
carryInPeriod
-
(
period
-
responseTime
),
0
)
...
...
src/main/java/mvd/jester/tests/MaiaBertogna.java
View file @
43947796
...
...
@@ -91,8 +91,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
long
interference
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
if
(
s
.
get
NumberOfJobs
()
>=
parallelism
+
1
)
{
interference
+=
s
.
get
JobWcet
();
if
(
s
.
get
Height
()
>=
parallelism
+
1
)
{
interference
+=
s
.
get
Width
();
}
}
...
...
@@ -112,8 +112,8 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
long
workload
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
if
(
s
.
get
NumberOfJobs
()
>=
parallelism
)
{
workload
+=
s
.
get
JobWcet
();
if
(
s
.
get
Height
()
>=
parallelism
)
{
workload
+=
s
.
get
Width
();
}
}
...
...
@@ -128,7 +128,7 @@ public class MaiaBertogna extends AbstractTest<SynchronousTask> {
private
long
getMinimumWcet
(
final
SynchronousTask
task
)
{
long
minWcet
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
minWcet
+=
s
.
get
JobWcet
();
minWcet
+=
s
.
get
Width
();
}
return
minWcet
;
...
...
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
43947796
...
...
@@ -11,6 +11,7 @@ import mvd.jester.model.SystemManagerInterface;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
import
mvd.jester.tests.TypeFunction.KnownStructureWithMaxThreads
;
/**
* SchmidMottok
...
...
@@ -54,14 +55,6 @@ 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
;
...
...
@@ -69,13 +62,8 @@ public class SchmidMottok extends AbstractTest<DagTask> {
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
for
(
int
p
=
0
;
p
<
numberOfThreads
;
++
p
)
{
if
(
occupiedProcessors
>
manager
.
getNumberOfProcessors
())
{
taskInterference
+=
Math
.
min
(
structure
.
getTaskInterference
(
t
,
responseTimes
,
responseTime
,
p
+
1
),
responseTime
-
minimumWcet
+
1
);
}
taskInterference
+=
Math
.
min
(
structure
.
getTaskInterference
(
t
,
responseTimes
,
responseTime
,
p
+
1
),
responseTime
-
minimumWcet
+
1
);
}
}
}
...
...
src/main/java/mvd/jester/tests/TypeFunction.java
View file @
43947796
...
...
@@ -44,10 +44,9 @@ public interface TypeFunction {
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
final
long
numberOfThreads
=
s
.
get
NumberOfJobs
()
>
1
?
manager
.
getNumberOfProcessors
()
:
1
;
s
.
get
Height
()
>
1
?
manager
.
getNumberOfProcessors
()
:
1
;
if
(
numberOfThreads
>=
parallelism
)
{
workload
+=
(
double
)
(
s
.
getNumberOfJobs
()
*
s
.
getJobWcet
())
/
numberOfThreads
;
workload
+=
(
double
)
(
s
.
getHeight
()
*
s
.
getWidth
())
/
numberOfThreads
;
}
}
...
...
@@ -98,8 +97,7 @@ public interface TypeFunction {
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
final
long
numberOfThreads
=
task
.
getNumberOfThreads
();
if
(
numberOfThreads
>=
parallelism
)
{
workload
+=
(
double
)
(
s
.
getNumberOfJobs
()
*
s
.
getJobWcet
())
/
numberOfThreads
;
workload
+=
(
double
)
(
s
.
getHeight
()
*
s
.
getWidth
())
/
numberOfThreads
;
}
}
...
...
@@ -148,11 +146,9 @@ public interface TypeFunction {
double
workload
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
final
long
numberOfThreads
=
s
.
getNumberOfJobs
()
>
1
?
task
.
getNumberOfThreads
()
:
1
;
final
long
numberOfThreads
=
s
.
getHeight
()
>
1
?
task
.
getNumberOfThreads
()
:
1
;
if
(
numberOfThreads
>=
parallelism
)
{
workload
+=
(
double
)
(
s
.
getNumberOfJobs
()
*
s
.
getJobWcet
())
/
numberOfThreads
;
workload
+=
(
double
)
(
s
.
getHeight
()
*
s
.
getWidth
())
/
numberOfThreads
;
}
}
...
...
src/test/java/mvd/jester/model/TestSegment.java
View file @
43947796
...
...
@@ -15,10 +15,10 @@ public class TestSegment {
Segment
s1
=
new
Segment
(
100
,
10
);
Segment
s2
=
new
Segment
(
9
,
10
);
assertTrue
(
s1
.
get
JobWcet
()
==
100
);
assertTrue
(
s1
.
get
NumberOfJobs
()
==
10
);
assertTrue
(
s1
.
get
Width
()
==
100
);
assertTrue
(
s1
.
get
Height
()
==
10
);
assertTrue
(
s2
.
get
JobWcet
()
==
9
);
assertTrue
(
s2
.
get
NumberOfJobs
()
==
10
);
assertTrue
(
s2
.
get
Width
()
==
9
);
assertTrue
(
s2
.
get
Height
()
==
10
);
}
}
src/test/java/mvd/jester/model/TestSystemSetup.java
View file @
43947796
...
...
@@ -39,10 +39,10 @@ public class TestSystemSetup {
long
maxJobWcet
=
t
.
getPeriod
()
/
t
.
getWorkloadDistribution
().
size
();
for
(
Segment
s
:
t
.
getWorkloadDistribution
())
{
assertTrue
(
s
.
get
JobWcet
()
>=
1
);
assertTrue
(
s
.
get
JobWcet
()
<=
maxJobWcet
);
assertTrue
(
s
.
get
NumberOfJobs
()
>=
1
);
assertTrue
(
s
.
get
NumberOfJobs
()
<=
10
);
assertTrue
(
s
.
get
Width
()
>=
1
);
assertTrue
(
s
.
get
Width
()
<=
maxJobWcet
);
assertTrue
(
s
.
get
Height
()
>=
1
);
assertTrue
(
s
.
get
Height
()
<=
10
);
}
assertTrue
(
t
.
getWorkloadDistribution
().
size
()
>=
1
);
...
...
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestJobContext.java
View file @
43947796
...
...
@@ -32,7 +32,7 @@ public class TestJobContext {
SegmentContext
sc
=
mock
(
SegmentContext
.
class
);
Segment
s
=
mock
(
Segment
.
class
);
when
(
sc
.
getSegment
()).
thenReturn
(
s
);
when
(
s
.
get
JobWcet
()).
thenReturn
((
long
)
20
);
when
(
s
.
get
Width
()).
thenReturn
((
long
)
20
);
when
(
sc
.
getNextTasklet
()).
thenReturn
(
Optional
.
of
(
tlc
))
.
thenReturn
(
Optional
.
ofNullable
(
null
));
...
...
@@ -53,7 +53,7 @@ public class TestJobContext {
SegmentContext
sc
=
mock
(
SegmentContext
.
class
);
Segment
s
=
mock
(
Segment
.
class
);
when
(
sc
.
getSegment
()).
thenReturn
(
s
);
when
(
s
.
get
JobWcet
()).
thenReturn
((
long
)
20
);
when
(
s
.
get
Width
()).
thenReturn
((
long
)
20
);
when
(
tlc
.
checkExecutionTime
()).
thenReturn
(
true
,
false
);
JobContext
jc
=
new
JobContext
(
tc
,
sc
);
...
...
@@ -75,7 +75,7 @@ public class TestJobContext {
when
(
sc
.
getSegment
()).
thenReturn
(
s
);
when
(
sc
.
getNextTasklet
()).
thenReturn
(
Optional
.
ofNullable
(
tlc
))
.
thenReturn
(
Optional
.
ofNullable
(
null
));
when
(
s
.
get
JobWcet
()).
thenReturn
((
long
)
20
);
when
(
s
.
get
Width
()).
thenReturn
((
long
)
20
);
when
(
tlc
.
checkExecutionTime
()).
thenReturn
(
true
,
false
);
when
(
tlc
.
updateExecution
(
not
(
eq
(
0
)))).
thenReturn
(
true
);
when
(
tlc
.
updateExecution
(
0
)).
thenReturn
(
false
);
...
...
src/test/java/mvd/jester/simulator/parallelsynchronous/TestJobContext.java
View file @
43947796
...
...
@@ -31,7 +31,7 @@ public class TestJobContext {
long
jobWcet
=
ThreadLocalRandom
.
current
().
nextLong
(
20
,
50
);
Segment
s
=
mock
(
Segment
.
class
);
when
(
s
.
get
JobWcet
()).
thenReturn
(
jobWcet
);
when
(
s
.
get
Width
()).
thenReturn
(
jobWcet
);
SegmentContext
sc
=
mock
(
SegmentContext
.
class
);
when
(
sc
.
getSegment
()).
thenReturn
(
s
);
TaskContext
tc
=
mock
(
TaskContext
.
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