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
6bc244f2
authored
5 years ago
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Different algorithms work now, log doesn't work
parent
6b226c2e
master
…
scheduler
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
190 additions
and
63 deletions
+190
-63
.gitignore
+2
-0
src/main/java/mvd/jester/App.java
+6
-1
src/main/java/mvd/jester/TestEnvironment.java
+73
-29
src/main/java/mvd/jester/model/SystemSetup.java
+9
-16
src/main/java/mvd/jester/priority/EarliestDeadlineFirst.java
+26
-1
src/main/java/mvd/jester/priority/PriorityManager.java
+8
-0
src/main/java/mvd/jester/priority/RateMonotonic.java
+27
-0
src/main/java/mvd/jester/simulator/AbstractSimulator.java
+15
-7
src/main/java/mvd/jester/simulator/SimulatorInterface.java
+3
-1
src/main/java/mvd/jester/simulator/internals/SortedTaskContextSet.java
+1
-1
src/main/java/mvd/jester/tests/AbstractTest.java
+3
-0
src/main/java/mvd/jester/tests/MaiaBertogna.java
+7
-3
src/main/java/mvd/jester/tests/SchmidMottok.java
+7
-3
src/main/java/mvd/jester/tests/TestInterface.java
+3
-1
No files found.
.gitignore
View file @
6bc244f2
/.vscode
/.settings
/results
/target
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/App.java
View file @
6bc244f2
package
mvd
.
jester
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.EarliestDeadlineFirst
;
import
mvd.jester.priority.RateMonotonic
;
/**
...
...
@@ -10,7 +12,10 @@ import mvd.jester.model.SystemSetup;
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
SystemSetup
.
Builder
builder
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
40000
);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
4000
);
te
.
registerSchedulingAlgorithm
(
new
RateMonotonic
());
te
.
registerSchedulingAlgorithm
(
new
EarliestDeadlineFirst
());
te
.
registerTestPair
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
,
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/TestEnvironment.java
View file @
6bc244f2
package
mvd
.
jester
;
import
java.io.PrintWriter
;
import
java.lang.reflect.Constructor
;
import
java.time.LocalTime
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.collect.Table
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.utils.Logger
;
...
...
@@ -20,44 +21,88 @@ public class TestEnvironment {
private
final
long
numberOfTaskSets
;
private
final
SystemSetup
systemSetup
;
private
final
SystemSetup
.
Builder
builder
;
private
final
Map
<
Constructor
<?
extends
AbstractTest
>,
Constructor
<?
extends
AbstractSimulator
>>
abstractTestPairs
;
private
final
Set
<
Constructor
<?
extends
AbstractTest
>>
abstractTests
;
private
final
Set
<
Constructor
<?
extends
AbstractSimulator
>>
abstractSimulators
;
private
final
Set
<
PriorityManager
>
schedulingAlgorithms
;
public
TestEnvironment
(
SystemSetup
.
Builder
builder
,
long
numberOfTaskSets
)
{
this
.
numberOfTaskSets
=
numberOfTaskSets
;
abstractTestPairs
=
new
HashMap
<>();
this
.
abstractTests
=
new
HashSet
<>();
this
.
abstractSimulators
=
new
HashSet
<>();
this
.
schedulingAlgorithms
=
new
HashSet
<>();
this
.
builder
=
builder
;
this
.
systemSetup
=
builder
.
build
();
}
public
TestEnvironment
registerSchedulingAlgorithm
(
PriorityManager
priorityManager
)
{
schedulingAlgorithms
.
add
(
priorityManager
);
return
this
;
}
public
TestEnvironment
registerTest
(
Class
<?
extends
AbstractTest
>
abstractTest
)
{
try
{
abstractTests
.
add
(
abstractTest
.
getConstructor
(
SystemSetup
.
class
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Missing constructor for abstract test!"
);
}
return
this
;
}
public
TestEnvironment
registerSimulator
(
Class
<?
extends
AbstractSimulator
>
abstractSimulator
)
{
try
{
abstractSimulators
.
add
(
abstractSimulator
.
getConstructor
(
SystemSetup
.
class
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Missing constructor for abstract simulator!"
);
}
return
this
;
}
public
TestEnvironment
registerTestPair
(
Class
<?
extends
AbstractTest
>
abstractTest
,
Class
<?
extends
AbstractSimulator
>
abstractSimulator
)
{
try
{
abstractTestPairs
.
put
(
abstractTest
.
getConstructor
(
SystemSetup
.
class
),
abstractSimulator
.
getConstructor
(
SystemSetup
.
class
));
abstractTests
.
add
(
abstractTest
.
getConstructor
(
SystemSetup
.
class
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Missing constructor for abstract test!"
);
}
try
{
abstractSimulators
.
add
(
abstractSimulator
.
getConstructor
(
SystemSetup
.
class
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Missing constructor!"
);
System
.
out
.
println
(
"Missing constructor
for abstract simulator
!"
);
}
return
this
;
}
public
void
runTests
()
{
Map
<
AbstractTest
,
AbstractSimulator
>
testPairs
=
new
HashMap
<>();
Set
<
AbstractTest
>
abstractTestInstances
=
new
HashSet
<>();
Set
<
AbstractSimulator
>
abstractSimulatorInstances
=
new
HashSet
<>();
Map
<
Long
,
Map
<
AbstractTest
,
Long
>>
testResults
=
new
HashMap
<>();
Map
<
Long
,
Map
<
AbstractSimulator
,
Long
>>
simulatorResults
=
new
HashMap
<>();
// Map<Long, Table<PriorityManager, AbstractTest, Long>> testResults = new HashMap<>();
// Map<Long, Table<PriorityManager, AbstractSimulator, Long>> simulatorResults =
// new HashMap<>();
for
(
Map
.
Entry
<
Constructor
<?
extends
AbstractTest
>,
Constructor
<?
extends
AbstractSimulator
>>
kv
:
abstractTestPairs
.
entrySet
())
{
for
(
Constructor
<?
extends
AbstractTest
>
c
:
abstractTests
)
{
try
{
testPairs
.
put
(
kv
.
getKey
().
newInstance
(
this
.
systemSetup
),
kv
.
getValue
().
newInstance
(
this
.
systemSetup
));
abstractTestInstances
.
add
(
c
.
newInstance
(
this
.
systemSetup
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not instantiate object of AbstractTest!"
);
}
}
for
(
Constructor
<?
extends
AbstractSimulator
>
c
:
abstractSimulators
)
{
try
{
abstractSimulatorInstances
.
add
(
c
.
newInstance
(
this
.
systemSetup
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not instantiate object of AbstractSimulator!"
);
}
}
long
checkedTasksets
=
0
;
while
(
checkedTasksets
<
numberOfTaskSets
)
{
...
...
@@ -74,29 +119,28 @@ public class TestEnvironment {
}
long
roundedUtilization
=
(
long
)
(
utilization
*
10
);
for
(
Map
.
Entry
<
AbstractTest
,
AbstractSimulator
>
kv
:
testPairs
.
entrySet
())
{
boolean
schedCheck
=
kv
.
getKey
().
runSchedulabilityCheck
();
boolean
simCheck
=
kv
.
getValue
().
runSimulation
();
if
(
schedCheck
)
{
for
(
PriorityManager
priorityManager
:
schedulingAlgorithms
)
{
for
(
AbstractTest
test
:
abstractTestInstances
)
{
if
(
priorityManager
.
hasTest
(
test
)
&&
test
.
runSchedulabilityCheck
(
priorityManager
))
{
testResults
.
computeIfAbsent
(
roundedUtilization
,
k
->
new
HashMap
<
AbstractTest
,
Long
>())
.
compute
(
kv
.
getKey
(),
(
k
,
v
)
->
(
v
==
null
)
?
1
:
v
+
1
);
.
compute
(
test
,
(
k
,
v
)
->
(
v
==
null
)
?
1
:
v
+
1
);
}
}
if
(
simCheck
)
{
for
(
AbstractSimulator
simulator
:
abstractSimulatorInstances
)
{
if
(
priorityManager
.
hasSimulator
(
simulator
)
&&
simulator
.
runSimulation
(
priorityManager
))
{
simulatorResults
.
computeIfAbsent
(
roundedUtilization
,
k
->
new
HashMap
<
AbstractSimulator
,
Long
>())
.
compute
(
kv
.
getValue
(),
(
k
,
v
)
->
(
v
==
null
)
?
1
:
v
+
1
);
}
if
(
schedCheck
==
true
&&
simCheck
==
false
)
{
try
(
PrintWriter
out
=
new
PrintWriter
(
"results/manualCheck"
+
checkedTasksets
+
".txt"
))
{
out
.
println
(
systemSetup
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Ähm something went horribly wrong!"
);
.
compute
(
simulator
,
(
k
,
v
)
->
(
v
==
null
)
?
1
:
v
+
1
);
}
}
}
builder
.
addTask
(
systemSetup
);
...
...
@@ -104,11 +148,11 @@ public class TestEnvironment {
}
}
log
Results
(
testPairs
.
keySet
()
,
testResults
);
logSimulation
s
(
new
HashSet
<
AbstractSimulator
>(
testPairs
.
values
())
,
simulatorResults
);
log
TestResults
(
abstractTestInstances
,
testResults
);
logSimulation
Results
(
abstractSimulatorInstances
,
simulatorResults
);
}
private
void
logResults
(
Set
<
AbstractTest
>
testCases
,
private
void
log
Test
Results
(
Set
<
AbstractTest
>
testCases
,
Map
<
Long
,
Map
<
AbstractTest
,
Long
>>
results
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/results_"
+
systemSetup
.
getNumberOfProcessors
()
+
"_"
...
...
@@ -138,7 +182,7 @@ public class TestEnvironment {
log
.
finalize
();
}
private
void
logSimulations
(
Set
<
AbstractSimulator
>
testCases
,
private
void
logSimulation
Result
s
(
Set
<
AbstractSimulator
>
testCases
,
Map
<
Long
,
Map
<
AbstractSimulator
,
Long
>>
results
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/results_sim_"
+
systemSetup
.
getNumberOfProcessors
()
+
"_"
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/model/SystemSetup.java
View file @
6bc244f2
...
...
@@ -4,22 +4,21 @@ import java.io.IOException;
import
java.nio.charset.Charset
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
java.util.concurrent.ThreadLocalRandom
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
/**
* TaskSet
*/
public
class
SystemSetup
{
private
S
ortedTaskSet
tasks
;
private
S
et
<
Task
>
tasks
;
private
final
long
numberOfProcessors
;
public
SystemSetup
(
S
ortedTaskSet
tasks
,
long
numberOfProcessors
)
{
public
SystemSetup
(
S
et
<
Task
>
tasks
,
long
numberOfProcessors
)
{
this
.
tasks
=
tasks
;
this
.
numberOfProcessors
=
numberOfProcessors
;
}
...
...
@@ -27,11 +26,11 @@ public class SystemSetup {
/**
* @return the tasks
*/
public
S
ortedTaskSet
getTasks
()
{
public
S
et
<
Task
>
getTasks
()
{
return
tasks
;
}
public
void
setTasks
(
S
ortedTaskSet
tasks
)
{
public
void
setTasks
(
S
et
<
Task
>
tasks
)
{
this
.
tasks
=
tasks
;
}
...
...
@@ -88,7 +87,6 @@ public class SystemSetup {
private
long
maxNumberOfJobs
=
3
*
numberOfProcessors
/
2
;
private
long
minWcet
=
1
;
private
long
ratio
=
randomTaskRatio
();
private
PriorityManager
priorityManager
=
new
RateMonotonic
();
public
Builder
()
{
...
...
@@ -139,8 +137,9 @@ public class SystemSetup {
return
new
Task
(
period
,
segments
);
}
private
SortedTaskSet
generateTaskSet
()
{
SortedTaskSet
taskSet
=
new
SortedTaskSet
(
priorityManager
);
private
Set
<
Task
>
generateTaskSet
()
{
// SortedTaskSet taskSet = new SortedTaskSet(priorityManager);
Set
<
Task
>
taskSet
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
Task
task
=
generateTask
();
...
...
@@ -152,7 +151,7 @@ public class SystemSetup {
public
SystemSetup
build
()
{
this
.
ratio
=
randomTaskRatio
();
S
ortedTaskSet
taskSet
=
generateTaskSet
();
S
et
<
Task
>
taskSet
=
generateTaskSet
();
return
new
SystemSetup
(
taskSet
,
numberOfProcessors
);
}
...
...
@@ -185,11 +184,6 @@ public class SystemSetup {
return
this
;
}
public
Builder
setPriorityManager
(
PriorityManager
priorityManager
)
{
this
.
priorityManager
=
priorityManager
;
return
this
;
}
/**
* @param maxNumberOfJobs the maxNumberOfJobs to set
*/
...
...
@@ -200,5 +194,4 @@ public class SystemSetup {
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/priority/EarliestDeadineFirst.java
→
src/main/java/mvd/jester/priority/EarliestDead
l
ineFirst.java
View file @
6bc244f2
package
mvd
.
jester
.
priority
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.MaiaBertogna
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.tests.AbstractTest
;
/**
* EarliestDeadineFirst
*/
public
class
EarliestDeadineFirst
implements
PriorityManager
{
public
class
EarliestDeadlineFirst
implements
PriorityManager
{
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
new
HashSet
<>();
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
new
HashSet
<>(
Arrays
.
asList
(
MaiaBertogna
.
class
));
/**
* Compare the priority of two tasks according to the Rate Monotonic policy
...
...
@@ -26,4 +36,19 @@ public class EarliestDeadineFirst implements PriorityManager {
public
int
compare
(
TaskContextInterface
t1
,
TaskContextInterface
t2
)
{
return
(
int
)
(
t1
.
getDeadline
()
-
t2
.
getDeadline
());
}
@Override
public
boolean
hasTest
(
AbstractTest
abstractTest
)
{
return
abstractTests
.
contains
(
abstractTest
.
getClass
());
}
@Override
public
boolean
hasSimulator
(
AbstractSimulator
abstractSimulator
)
{
return
abstractSimulators
.
contains
(
abstractSimulator
.
getClass
());
}
@Override
public
String
getName
()
{
return
"EDF"
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/priority/PriorityManager.java
View file @
6bc244f2
package
mvd
.
jester
.
priority
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.tests.AbstractTest
;
/**
* PriorityManager
...
...
@@ -12,4 +14,10 @@ public interface PriorityManager {
public
int
compare
(
TaskContextInterface
t1
,
TaskContextInterface
t2
);
public
boolean
hasTest
(
AbstractTest
abstractTest
);
public
boolean
hasSimulator
(
AbstractSimulator
abstractTest
);
public
String
getName
();
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/priority/RateMonotonic.java
View file @
6bc244f2
package
mvd
.
jester
.
priority
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.tests.AbstractTest
;
public
class
RateMonotonic
implements
PriorityManager
{
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
new
HashSet
<>(
Arrays
.
asList
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
,
mvd
.
jester
.
tests
.
SchmidMottok
.
class
));
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
new
HashSet
<>(
Arrays
.
asList
(
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
,
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
));
/**
* Compare the priority of two tasks according to the Rate Monotonic policy
*
...
...
@@ -22,4 +33,20 @@ public class RateMonotonic implements PriorityManager {
public
int
compare
(
TaskContextInterface
t1
,
TaskContextInterface
t2
)
{
return
Long
.
compare
(
t1
.
getTask
().
getPeriod
(),
t2
.
getTask
().
getPeriod
());
}
@Override
public
boolean
hasTest
(
AbstractTest
abstractTest
)
{
return
abstractTests
.
contains
(
abstractTest
.
getClass
());
}
@Override
public
boolean
hasSimulator
(
AbstractSimulator
abstractSimulator
)
{
return
abstractSimulators
.
contains
(
abstractSimulator
.
getClass
());
}
@Override
public
String
getName
()
{
return
"RM"
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/AbstractSimulator.java
View file @
6bc244f2
...
...
@@ -6,6 +6,8 @@ import java.util.Optional;
import
java.util.Set
;
import
java.util.TreeSet
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.priority.RateMonotonic
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.SortedTaskContextSet
;
...
...
@@ -19,7 +21,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
protected
final
SystemSetup
systemSetup
;
protected
final
Set
<
ProcessorContext
>
processors
;
protected
final
SortedTaskContextSet
readyTasks
;
protected
Set
<
TaskContextInterface
>
readyTasks
;
protected
long
hyperPeriod
;
AbstractSimulator
(
SystemSetup
systemSetup
)
{
...
...
@@ -29,15 +31,16 @@ public abstract class AbstractSimulator implements SimulatorInterface {
for
(
int
i
=
0
;
i
<
systemSetup
.
getNumberOfProcessors
();
++
i
)
{
processors
.
add
(
new
ProcessorContext
(
i
));
}
this
.
hyperPeriod
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
2
/* * 10 */
;
this
.
hyperPeriod
=
getHyperPeriod
();
}
protected
abstract
boolean
releaseTasks
(
long
timeStep
);
@Override
public
boolean
runSimulation
()
{
init
();
public
boolean
runSimulation
(
PriorityManager
priorityManager
)
{
init
(
priorityManager
);
for
(
int
t
=
0
;
t
<
hyperPeriod
;
++
t
)
{
if
(!
releaseTasks
(
t
))
{
return
false
;
...
...
@@ -70,12 +73,12 @@ public abstract class AbstractSimulator implements SimulatorInterface {
return
true
;
}
private
void
init
()
{
this
.
readyTasks
.
clear
(
);
private
void
init
(
PriorityManager
priorityManager
)
{
this
.
readyTasks
=
new
SortedTaskContextSet
(
priorityManager
);
for
(
ProcessorContext
p
:
processors
)
{
p
.
setJob
(
null
);
}
this
.
hyperPeriod
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
2
;
this
.
hyperPeriod
=
getHyperPeriod
()
;
}
private
Set
<
ProcessorContext
>
sortProcessors
(
Set
<
ProcessorContext
>
processors
)
{
...
...
@@ -86,6 +89,11 @@ public abstract class AbstractSimulator implements SimulatorInterface {
return
sortedProcessors
;
}
private
long
getHyperPeriod
()
{
return
systemSetup
.
getTasks
().
stream
().
max
(
Comparator
.
comparing
(
Task:
:
getPeriod
)).
get
()
.
getPeriod
()
*
2
;
/* * 10 */
}
private
class
ProcessorComparator
implements
Comparator
<
ProcessorContext
>
{
@Override
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/SimulatorInterface.java
View file @
6bc244f2
package
mvd
.
jester
.
simulator
;
import
mvd.jester.priority.PriorityManager
;
/**
* SimulatorInterface
*/
public
interface
SimulatorInterface
{
public
boolean
runSimulation
();
public
boolean
runSimulation
(
PriorityManager
priorityManager
);
public
String
getName
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/SortedTaskContextSet.java
View file @
6bc244f2
...
...
@@ -11,7 +11,7 @@ public class SortedTaskContextSet extends TreeSet<TaskContextInterface> {
private
static
final
long
serialVersionUID
=
4808544133562675597L
;
public
SortedTaskContextSet
(
PriorityManager
priorityMananger
)
{
super
((
t1
,
t2
)
->
priorityMananger
.
compare
(
t1
.
getTask
(),
t2
.
getTask
()
));
super
((
t1
,
t2
)
->
priorityMananger
.
compare
(
t1
,
t2
));
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/AbstractTest.java
View file @
6bc244f2
...
...
@@ -2,6 +2,7 @@ package mvd.jester.tests;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
...
...
@@ -12,9 +13,11 @@ public abstract class AbstractTest implements TestInterface {
protected
final
Map
<
Task
,
Long
>
responseTimes
;
protected
final
SystemSetup
systemSetup
;
protected
Set
<
Task
>
tasks
;
public
AbstractTest
(
SystemSetup
systemSetup
)
{
this
.
systemSetup
=
systemSetup
;
this
.
responseTimes
=
new
HashMap
<
Task
,
Long
>();
this
.
tasks
=
systemSetup
.
getTasks
();
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/MaiaBertogna.java
View file @
6bc244f2
...
...
@@ -4,7 +4,9 @@ import java.math.RoundingMode;
import
java.util.Map.Entry
;
import
com.google.common.math.LongMath
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.model.SystemSetup
;
/**
...
...
@@ -17,9 +19,11 @@ public class MaiaBertogna extends AbstractTest {
}
@Override
public
boolean
runSchedulabilityCheck
()
{
public
boolean
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
tasks
=
new
SortedTaskSet
(
priorityManager
);
tasks
.
addAll
(
systemSetup
.
getTasks
());
responseTimes
.
clear
();
for
(
Task
t
:
systemSetup
.
getTasks
()
)
{
for
(
Task
t
:
tasks
)
{
responseTimes
.
put
(
t
,
calculateResponseTime
(
t
));
}
...
...
@@ -46,7 +50,7 @@ public class MaiaBertogna extends AbstractTest {
previousResponseTime
=
responseTime
;
long
taskInterference
=
0
;
for
(
Task
t
:
systemSetup
.
getTasks
()
)
{
for
(
Task
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
long
maxNumberOfJobsOfT
=
t
.
getMaximumParallelism
();
for
(
int
p
=
0
;
p
<
maxNumberOfJobsOfT
;
++
p
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
6bc244f2
...
...
@@ -4,7 +4,9 @@ import java.math.RoundingMode;
import
java.util.Map.Entry
;
import
com.google.common.math.LongMath
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.Task
;
import
mvd.jester.priority.PriorityManager
;
import
mvd.jester.model.SystemSetup
;
/**
...
...
@@ -17,9 +19,11 @@ public class SchmidMottok extends AbstractTest {
}
@Override
public
boolean
runSchedulabilityCheck
()
{
public
boolean
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
tasks
=
new
SortedTaskSet
(
priorityManager
);
tasks
.
addAll
(
systemSetup
.
getTasks
());
responseTimes
.
clear
();
for
(
Task
t
:
systemSetup
.
getTasks
()
)
{
for
(
Task
t
:
tasks
)
{
responseTimes
.
put
(
t
,
calculateResponseTime
(
t
));
}
...
...
@@ -47,7 +51,7 @@ public class SchmidMottok extends AbstractTest {
previousResponseTime
=
responseTime
;
double
taskInterference
=
0
;
for
(
Task
t
:
systemSetup
.
getTasks
()
)
{
for
(
Task
t
:
tasks
)
{
if
(
t
.
getPeriod
()
<
task
.
getPeriod
())
{
long
numberOfJobs
=
t
.
getMaximumParallelism
()
>
numberOfProcessors
?
numberOfProcessors
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/TestInterface.java
View file @
6bc244f2
package
mvd
.
jester
.
tests
;
import
mvd.jester.priority.PriorityManager
;
/**
* TestInterface
*/
public
interface
TestInterface
{
public
boolean
runSchedulabilityCheck
();
public
boolean
runSchedulabilityCheck
(
PriorityManager
priorityManager
);
public
String
getName
();
...
...
This diff is collapsed.
Click to expand it.
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