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
84d3cbf6
authored
Oct 08, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tester
parent
9ad4681d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
16 deletions
+166
-16
src/main/java/mvd/jester/App.java
+15
-12
src/main/java/mvd/jester/TestEnvironment.java
+1
-1
src/main/java/mvd/jester/model/SystemManager.java
+7
-3
src/main/java/mvd/jester/tests/Tester.java
+93
-0
src/main/java/mvd/jester/tests/TypeFunction.java
+50
-0
No files found.
src/main/java/mvd/jester/App.java
View file @
84d3cbf6
...
@@ -12,9 +12,11 @@ import mvd.jester.tests.FonsecaNelis;
...
@@ -12,9 +12,11 @@ import mvd.jester.tests.FonsecaNelis;
import
mvd.jester.tests.JiangYi
;
import
mvd.jester.tests.JiangYi
;
import
mvd.jester.tests.MelaniButtazzo
;
import
mvd.jester.tests.MelaniButtazzo
;
import
mvd.jester.tests.SchmidMottok
;
import
mvd.jester.tests.SchmidMottok
;
import
mvd.jester.tests.Tester
;
import
mvd.jester.tests.TypeFunction.KnownStructureWithMaxThreads
;
import
mvd.jester.tests.TypeFunction.KnownStructureWithMaxThreads
;
import
mvd.jester.tests.TypeFunction.KnownStructure
;
import
mvd.jester.tests.TypeFunction.KnownStructure
;
import
mvd.jester.tests.TypeFunction.UnkownStructure
;
import
mvd.jester.tests.TypeFunction.UnkownStructure
;
import
mvd.jester.tests.TypeFunction.TestFunction
;
/**
/**
...
@@ -25,29 +27,30 @@ public class App {
...
@@ -25,29 +27,30 @@ public class App {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
{
{
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
SystemManager
<
DagTaskBuilder
>
manager
=
new
SystemManager
<>(
DagTaskBuilder
.
class
);
manager
.
setNumberOfProcessors
(
32
);
TestEnvironment
te
=
new
TestEnvironment
();
TestEnvironment
te
=
new
TestEnvironment
();
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
List
<
AbstractTest
<
DagTask
>>
tests
=
te
.
registerTests
(
Arrays
.
asList
(
new
SchmidMottok
(
new
KnownStructureWithMaxThreads
(
manager
),
manager
),
new
SchmidMottok
(
new
KnownStructureWithMaxThreads
(
manager
),
manager
),
new
SchmidMottok
(
new
KnownStructure
(),
manager
),
new
Tester
(
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
,
100
);
te
.
varyRenyiUtilization
(
manager
,
tests
,
100
);
}
}
// {
// {
//
SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
//
TestEnvironment te = new TestEnvironment();
// TestEnvironment te = new TestEnvironment();
//
List<AbstractTest<DagTask>> tests = te.registerTests(Arrays.asList(
// List<AbstractTest<DagTask>> tests = te.registerTests(Arrays.asList(
//
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)
//
));
// ));
//
te.varyUtilization(manager, tests, 500);
// te.varyUtilization(manager, tests, 500);
// }
// }
// {
// {
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
// SystemManager<DagTaskBuilder> manager = new SystemManager<>(DagTaskBuilder.class);
...
...
src/main/java/mvd/jester/TestEnvironment.java
View file @
84d3cbf6
...
@@ -244,7 +244,7 @@ public class TestEnvironment {
...
@@ -244,7 +244,7 @@ public class TestEnvironment {
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
abstractTestInstances
.
forEach
(
t
->
resultMap
.
put
(
t
,
(
long
)
0
));
resultLogger
.
logHeader
(
resultMap
,
"Utilization"
);
resultLogger
.
logHeader
(
resultMap
,
"Utilization"
);
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
0.25
)
{
for
(
double
util
=
1
;
util
<=
numberOfProcessors
;
util
+=
(
double
)
numberOfProcessors
/
32
)
{
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
resultMap
.
replaceAll
((
k
,
v
)
->
(
long
)
0
);
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberOfTaskSetsPerUtil
;
++
i
)
{
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
().
generateRenyiTaskSet
(
util
);
final
Set
<
DagTask
>
taskSet
=
manager
.
getBuilder
().
generateRenyiTaskSet
(
util
);
...
...
src/main/java/mvd/jester/model/SystemManager.java
View file @
84d3cbf6
...
@@ -179,7 +179,7 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
...
@@ -179,7 +179,7 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
private
long
maxNumberOfThreads
=
numberOfProcessors
;
private
long
maxNumberOfThreads
=
numberOfProcessors
;
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
=
10
;
public
DagTaskBuilder
()
{
public
DagTaskBuilder
()
{
}
}
...
@@ -280,14 +280,18 @@ public class SystemManager<T extends Builder> implements SystemManagerInterface
...
@@ -280,14 +280,18 @@ 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
numberOfThreads
=
randomNumberOfThreads
(
numberOfProcessors
/
2
);
// final long numberOfThreads = randomNumberOfThreads(numberOfProcessors / 2);
// TODO: Change back to above
final
long
numberOfThreads
=
LongMath
.
divide
(
workload
-
criticalPath
,
period
-
criticalPath
,
RoundingMode
.
CEILING
);
return
new
DagTask
(
jobDag
,
period
,
numberOfThreads
);
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
=
(
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
gamma
=
new
GammaDistribution
(
2
,
1
).
sample
();
final
double
secondPart
=
1
+
0.25
*
gamma
;
final
double
secondPart
=
1
+
0.25
*
gamma
;
...
...
src/main/java/mvd/jester/tests/Tester.java
0 → 100644
View file @
84d3cbf6
package
mvd
.
jester
.
tests
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.DagTask
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemManagerInterface
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
public
class
Tester
extends
AbstractTest
<
DagTask
>
{
private
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
private
final
PriorityManager
priorityManager
;
private
final
TypeFunction
structure
;
public
Tester
(
TypeFunction
structure
,
final
SystemManagerInterface
manager
)
{
super
(
manager
);
this
.
responseTimes
=
new
HashMap
<>();
this
.
priorityManager
=
new
RateMonotonic
();
this
.
structure
=
structure
;
}
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
SortedTaskSet
<
DagTask
>
tasks
)
{
responseTimes
.
clear
();
for
(
final
DagTask
t
:
tasks
)
{
final
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
));
}
return
new
SchedulingInfo
(
responseTimes
.
values
());
}
@Override
public
PriorityManager
getPriorityManager
()
{
return
priorityManager
;
}
@Override
public
String
getName
()
{
return
"Tester_"
+
structure
.
getType
();
}
private
long
calculateResponseTime
(
final
Set
<
DagTask
>
tasks
,
final
DagTask
task
)
{
final
long
minimumWcet
=
task
.
getCriticalPath
();
long
responseTime
=
minimumWcet
;
long
previousResponseTime
=
0
;
long
currentNumberOfThreads
=
0
;
for
(
final
DagTask
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
final
long
numberOfThreads
=
structure
.
getNumberOfThreads
(
t
);
currentNumberOfThreads
+=
numberOfThreads
;
}
}
do
{
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
if
(
currentNumberOfThreads
+
structure
.
getNumberOfThreads
(
task
)
>
manager
.
getNumberOfProcessors
())
{
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
);
final
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
responseTime
=
minimumWcet
+
totalInterference
;
}
while
(
previousResponseTime
!=
responseTime
);
return
responseTime
;
}
}
src/main/java/mvd/jester/tests/TypeFunction.java
View file @
84d3cbf6
...
@@ -181,4 +181,54 @@ public interface TypeFunction {
...
@@ -181,4 +181,54 @@ public interface TypeFunction {
}
}
}
}
public
class
TestFunction
implements
TypeFunction
{
@Override
public
double
getTaskInterference
(
final
DagTask
task
,
final
Map
<
Task
,
TerminationInfo
>
responseTimes
,
final
long
interval
,
final
long
parallelism
)
{
if
(
responseTimes
.
containsKey
(
task
))
{
final
long
minWcet
=
task
.
getCriticalPath
();
final
long
period
=
task
.
getPeriod
();
final
long
amountOfJobs
=
(
LongMath
.
divide
(
interval
+
period
-
minWcet
,
period
,
RoundingMode
.
FLOOR
)
+
1
);
double
workload
=
0
;
for
(
final
Segment
s
:
task
.
getWorkloadDistribution
())
{
final
long
numberOfThreads
=
s
.
getHeight
()
>
1
?
task
.
getNumberOfThreads
()
:
1
;
if
(
numberOfThreads
>=
parallelism
)
{
workload
+=
(
double
)
(
s
.
getHeight
()
*
s
.
getWidth
())
/
numberOfThreads
;
}
}
final
double
interference
=
amountOfJobs
*
workload
;
return
interference
;
}
else
{
throw
new
RuntimeException
(
"Task was not found in task set!"
);
}
}
@Override
public
double
getSelfInterference
(
final
DagTask
task
)
{
final
long
numberOfThreads
=
task
.
getNumberOfThreads
();
double
interference
=
task
.
getWorkload
()
-
task
.
getCriticalPath
();
interference
/=
numberOfThreads
;
return
interference
;
}
@Override
public
String
getType
()
{
return
"TS"
;
}
@Override
public
long
getNumberOfThreads
(
final
DagTask
task
)
{
return
task
.
getNumberOfThreads
();
}
}
}
}
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