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
a9eacf10
authored
5 years ago
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed namespace and added a few tests
parent
4391562c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
564 additions
and
122 deletions
+564
-122
pom.xml
+17
-0
src/main/java/mvd/jester/App.java
+10
-22
src/main/java/mvd/jester/ResultCollector.java
+2
-2
src/main/java/mvd/jester/ResultLogger.java
+0
-0
src/main/java/mvd/jester/info/SchedulingInfo.java
+9
-3
src/main/java/mvd/jester/info/TerminationInfo.java
+28
-0
src/main/java/mvd/jester/model/SystemSetup.java
+2
-2
src/main/java/mvd/jester/priority/EarliestDeadlineFirst.java
+3
-3
src/main/java/mvd/jester/priority/RateMonotonic.java
+4
-4
src/main/java/mvd/jester/simulator/AbstractSimulator.java
+8
-9
src/main/java/mvd/jester/simulator/DynamicForkJoin.java
+3
-3
src/main/java/mvd/jester/simulator/ParallelSynchronous.java
+3
-3
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/JobContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/SegmentContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/TaskContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/dynamicforkjoin/TaskletContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/JobContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/SegmentContext.java
+1
-1
src/main/java/mvd/jester/simulator/internals/parallelsynchronous/TaskContext.java
+1
-2
src/main/java/mvd/jester/tests/AbstractTest.java
+0
-3
src/main/java/mvd/jester/tests/ChwaLee.java
+7
-4
src/main/java/mvd/jester/tests/MaiaBertogna.java
+7
-4
src/main/java/mvd/jester/tests/SchmidMottok.java
+7
-4
src/main/java/mvd/jester/utils/Logger.java
+2
-2
src/test/java/mvd/jester/TestResultCollector.java
+62
-0
src/test/java/mvd/jester/info/TestSchedulingInfo.java
+79
-0
src/test/java/mvd/jester/info/TestTerminationInfo.java
+40
-0
src/test/java/mvd/jester/model/TestSystemSetup.java
+53
-5
src/test/java/mvd/jester/priority/TestEarliestDeadlineFirst.java
+44
-6
src/test/java/mvd/jester/priority/TestRateMonotonic.java
+42
-5
src/test/java/mvd/jester/simulator/TestProcessorContext.java
+2
-2
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestJobContext.java
+5
-5
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestSegmentContext.java
+5
-5
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestTaskContext.java
+2
-2
src/test/java/mvd/jester/simulator/dynamicforkjoin/TestTaskletContext.java
+5
-5
src/test/java/mvd/jester/simulator/parallelsynchronous/TestJobContext.java
+4
-4
src/test/java/mvd/jester/simulator/parallelsynchronous/TestSegmentContext.java
+3
-3
src/test/java/mvd/jester/simulator/parallelsynchronous/TestTaskContext.java
+2
-2
src/test/java/mvd/jester/tests/TestMaiaBertogna.java
+40
-2
src/test/java/mvd/jester/tests/TestSchmidMottok.java
+57
-0
No files found.
pom.xml
View file @
a9eacf10
...
@@ -15,6 +15,12 @@
...
@@ -15,6 +15,12 @@
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<groupId>
net.sourceforge.cobertura
</groupId>
<artifactId>
cobertura
</artifactId>
<version>
2.1.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-math3
</artifactId>
<artifactId>
commons-math3
</artifactId>
...
@@ -56,6 +62,17 @@
...
@@ -56,6 +62,17 @@
</dependency>
</dependency>
</dependencies>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
cobertura-maven-plugin
</artifactId>
<version>
2.7
</version>
</plugin>
</plugins>
</reporting>
<build>
<build>
<pluginManagement>
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<pluginManagement>
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugins>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/App.java
View file @
a9eacf10
...
@@ -11,30 +11,18 @@ import mvd.jester.priority.RateMonotonic;
...
@@ -11,30 +11,18 @@ import mvd.jester.priority.RateMonotonic;
*/
*/
public
class
App
{
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SystemSetup
.
Builder
builder
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
8
);
for
(
int
p
=
4
;
p
<=
16
;
p
*=
2
)
{
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
40000
);
SystemSetup
.
Builder
builder
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
p
);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
40000
);
te
.
registerSchedulingAlgorithm
(
new
RateMonotonic
());
te
.
registerSchedulingAlgorithm
(
new
RateMonotonic
());
te
.
registerSchedulingAlgorithm
(
new
EarliestDeadlineFirst
());
te
.
registerSchedulingAlgorithm
(
new
EarliestDeadlineFirst
());
te
.
registerTest
(
mvd
.
jester
.
tests
.
SchmidMottok
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
SchmidMottok
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
ChwaLee
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
ChwaLee
.
class
);
te
.
registerSimulator
(
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
);
te
.
runExperiments
();
te
.
registerSimulator
(
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
);
}
te
.
runExperiments
();
// SystemSetup setup = SystemSetup.readFromFile(
// "/home/mike/Promotion/projects/eclipse/jester/results/test_this.txt", 16);
// SchmidMottok sm = new SchmidMottok(setup);
// MaiaBertogna mb = new MaiaBertogna(setup);
// RateMonotonic rm = new RateMonotonic();
// sm.runSchedulabilityCheck(rm);
// mb.runSchedulabilityCheck(rm);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/ResultCollector.java
View file @
a9eacf10
...
@@ -39,8 +39,8 @@ public class ResultCollector<T extends TypeInterface>
...
@@ -39,8 +39,8 @@ public class ResultCollector<T extends TypeInterface>
}
}
public
void
addResult
(
SchedulingInfo
schedulingInfo
)
{
public
boolean
addResult
(
SchedulingInfo
schedulingInfo
)
{
this
.
schedulingInfos
.
add
(
schedulingInfo
);
return
this
.
schedulingInfos
.
add
(
schedulingInfo
);
}
}
public
Set
<
SchedulingInfo
>
getResults
()
{
public
Set
<
SchedulingInfo
>
getResults
()
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/ResultLogger.java
View file @
a9eacf10
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/info/SchedulingInfo.java
View file @
a9eacf10
...
@@ -3,9 +3,10 @@ package mvd.jester.info;
...
@@ -3,9 +3,10 @@ package mvd.jester.info;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.Set
;
import
mvd.jester.info.TerminationInfo.Level
;
/**
/**
*
DeadlineMiss
Info
*
Scheduling
Info
*/
*/
public
class
SchedulingInfo
{
public
class
SchedulingInfo
{
...
@@ -44,13 +45,18 @@ public class SchedulingInfo {
...
@@ -44,13 +45,18 @@ public class SchedulingInfo {
terminationInfos
.
stream
().
filter
(
t
->
t
.
getLateness
()
>
0
).
findFirst
();
terminationInfos
.
stream
().
filter
(
t
->
t
.
getLateness
()
>
0
).
findFirst
();
}
}
public
boolean
checkLevelFail
(
Level
level
)
{
return
terminationInfos
.
stream
()
.
anyMatch
(
t
->
t
.
getLateness
()
>
0
&&
t
.
getTaskLevel
()
==
level
);
}
public
boolean
checkTasksetFeasible
()
{
public
boolean
checkTasksetFeasible
()
{
// return terminationInfos.isEmpty();
// return terminationInfos.isEmpty();
return
!
terminationInfos
.
stream
().
anyMatch
(
t
->
t
.
getLateness
()
>
0
);
return
!
terminationInfos
.
stream
().
anyMatch
(
t
->
t
.
getLateness
()
>
0
);
}
}
public
void
addTerminationInfo
(
TerminationInfo
terminationInfo
)
{
public
boolean
addTerminationInfo
(
TerminationInfo
terminationInfo
)
{
terminationInfos
.
add
(
terminationInfo
);
return
terminationInfos
.
add
(
terminationInfo
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/info/TerminationInfo.java
View file @
a9eacf10
...
@@ -9,14 +9,31 @@ public class TerminationInfo {
...
@@ -9,14 +9,31 @@ public class TerminationInfo {
private
final
long
deadline
;
private
final
long
deadline
;
private
final
long
responseTime
;
private
final
long
responseTime
;
private
final
long
lateness
;
private
final
long
lateness
;
private
final
Level
taskLevel
;
public
TerminationInfo
(
long
releaseTime
,
long
deadline
,
long
responseTime
)
{
public
TerminationInfo
(
long
releaseTime
,
long
deadline
,
long
responseTime
)
{
this
.
releaseTime
=
releaseTime
;
this
.
releaseTime
=
releaseTime
;
this
.
deadline
=
deadline
;
this
.
deadline
=
deadline
;
this
.
responseTime
=
responseTime
;
this
.
responseTime
=
responseTime
;
this
.
lateness
=
responseTime
-
deadline
;
this
.
lateness
=
responseTime
-
deadline
;
this
.
taskLevel
=
Level
.
LOW
;
}
}
public
TerminationInfo
(
long
releaseTime
,
long
deadline
,
long
responseTime
,
Level
taskLevel
)
{
this
.
releaseTime
=
releaseTime
;
this
.
deadline
=
deadline
;
this
.
responseTime
=
responseTime
;
this
.
lateness
=
responseTime
-
deadline
;
this
.
taskLevel
=
taskLevel
;
}
public
TerminationInfo
(
long
deadline
,
long
responseTime
,
Level
taskLevel
)
{
this
.
releaseTime
=
0
;
this
.
deadline
=
deadline
;
this
.
responseTime
=
responseTime
;
this
.
lateness
=
responseTime
-
deadline
;
this
.
taskLevel
=
taskLevel
;
}
/**
/**
* @return the deadline
* @return the deadline
...
@@ -45,4 +62,15 @@ public class TerminationInfo {
...
@@ -45,4 +62,15 @@ public class TerminationInfo {
public
long
getResponseTime
()
{
public
long
getResponseTime
()
{
return
responseTime
;
return
responseTime
;
}
}
/**
* @return the taskLevel
*/
public
Level
getTaskLevel
()
{
return
taskLevel
;
}
public
enum
Level
{
HIGH
,
LOW
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/model/SystemSetup.java
View file @
a9eacf10
...
@@ -180,8 +180,8 @@ public class SystemSetup {
...
@@ -180,8 +180,8 @@ public class SystemSetup {
systemSetup
.
tasks
=
generateTaskSet
();
systemSetup
.
tasks
=
generateTaskSet
();
}
}
public
void
addTask
(
SystemSetup
systemSetup
)
{
public
boolean
addTask
(
SystemSetup
systemSetup
)
{
systemSetup
.
tasks
.
add
(
generateTask
());
return
systemSetup
.
tasks
.
add
(
generateTask
());
}
}
public
Builder
setNumberOfProcessors
(
long
numberOfProcessors
)
{
public
Builder
setNumberOfProcessors
(
long
numberOfProcessors
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/priority/EarliestDeadlineFirst.java
View file @
a9eacf10
...
@@ -5,8 +5,8 @@ import java.util.HashSet;
...
@@ -5,8 +5,8 @@ import java.util.HashSet;
import
java.util.Set
;
import
java.util.Set
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.
MaiaBertogna
;
import
mvd.jester.simulator.
ParallelSynchronous
;
import
mvd.jester.simulator.
SchmidMottok
;
import
mvd.jester.simulator.
DynamicForkJoin
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.tests.ChwaLee
;
import
mvd.jester.tests.ChwaLee
;
...
@@ -19,7 +19,7 @@ public class EarliestDeadlineFirst implements PriorityManager {
...
@@ -19,7 +19,7 @@ public class EarliestDeadlineFirst implements PriorityManager {
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
new
HashSet
<>(
Arrays
.
asList
(
ChwaLee
.
class
));
new
HashSet
<>(
Arrays
.
asList
(
ChwaLee
.
class
));
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
new
HashSet
<>(
Arrays
.
asList
(
MaiaBertogna
.
class
,
SchmidMottok
.
class
));
new
HashSet
<>(
Arrays
.
asList
(
ParallelSynchronous
.
class
,
DynamicForkJoin
.
class
));
/**
/**
* Compare the priority of two tasks according to the Rate Monotonic policy
* Compare the priority of two tasks according to the Rate Monotonic policy
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/priority/RateMonotonic.java
View file @
a9eacf10
...
@@ -13,16 +13,16 @@ public class RateMonotonic implements PriorityManager {
...
@@ -13,16 +13,16 @@ public class RateMonotonic implements PriorityManager {
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
new
HashSet
<>(
Arrays
final
static
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
=
new
HashSet
<>(
Arrays
.
asList
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
,
mvd
.
jester
.
tests
.
SchmidMottok
.
class
));
.
asList
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
,
mvd
.
jester
.
tests
.
SchmidMottok
.
class
));
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
final
static
Set
<
Class
<?
extends
AbstractSimulator
>>
abstractSimulators
=
new
HashSet
<>(
Arrays
.
asList
(
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
,
new
HashSet
<>(
Arrays
.
asList
(
mvd
.
jester
.
simulator
.
ParallelSynchronous
.
class
,
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
));
mvd
.
jester
.
simulator
.
DynamicForkJoin
.
class
));
/**
/**
* Compare the priority of two tasks according to the Rate Monotonic policy
* Compare the priority of two tasks according to the Rate Monotonic policy
*
*
* @param t1 The first task
* @param t1 The first task
* @param t2 The second task
* @param t2 The second task
* @return 0 if both tasks have the same priority,
posi
tive number if the first task has a
* @return 0 if both tasks have the same priority,
nega
tive number if the first task has a
* higher priority,
nega
tive number if the second task has a higher priority
* higher priority,
posi
tive number if the second task has a higher priority
*/
*/
@Override
@Override
public
int
compare
(
Task
t1
,
Task
t2
)
{
public
int
compare
(
Task
t1
,
Task
t2
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/AbstractSimulator.java
View file @
a9eacf10
...
@@ -25,7 +25,6 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
...
@@ -25,7 +25,6 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
protected
final
SystemSetup
systemSetup
;
protected
final
SystemSetup
systemSetup
;
protected
final
Set
<
ProcessorContext
>
processors
;
protected
final
Set
<
ProcessorContext
>
processors
;
protected
TreeMultiset
<
TaskContextInterface
>
readyTasks
;
protected
TreeMultiset
<
TaskContextInterface
>
readyTasks
;
protected
long
hyperPeriod
;
AbstractSimulator
(
SystemSetup
systemSetup
)
{
AbstractSimulator
(
SystemSetup
systemSetup
)
{
this
.
systemSetup
=
systemSetup
;
this
.
systemSetup
=
systemSetup
;
...
@@ -34,8 +33,6 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
...
@@ -34,8 +33,6 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
for
(
int
i
=
0
;
i
<
systemSetup
.
getNumberOfProcessors
();
++
i
)
{
for
(
int
i
=
0
;
i
<
systemSetup
.
getNumberOfProcessors
();
++
i
)
{
processors
.
add
(
new
ProcessorContext
(
i
));
processors
.
add
(
new
ProcessorContext
(
i
));
}
}
this
.
hyperPeriod
=
getHyperPeriod
();
}
}
...
@@ -45,7 +42,7 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
...
@@ -45,7 +42,7 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
public
SchedulingInfo
runSimulation
(
PriorityManager
priorityManager
)
{
public
SchedulingInfo
runSimulation
(
PriorityManager
priorityManager
)
{
SchedulingInfo
schedulingInfo
=
new
SchedulingInfo
(
systemSetup
.
getParallelTaskRatio
(),
SchedulingInfo
schedulingInfo
=
new
SchedulingInfo
(
systemSetup
.
getParallelTaskRatio
(),
systemSetup
.
getUtilization
());
systemSetup
.
getUtilization
());
init
(
priorityManager
);
long
hyperPeriod
=
init
(
priorityManager
);
for
(
int
t
=
0
;
t
<
hyperPeriod
;
++
t
)
{
for
(
int
t
=
0
;
t
<
hyperPeriod
;
++
t
)
{
if
(!
releaseTasks
(
t
))
{
if
(!
releaseTasks
(
t
))
{
throw
new
RuntimeException
(
"Could not release a task. This should not happen!"
);
throw
new
RuntimeException
(
"Could not release a task. This should not happen!"
);
...
@@ -66,10 +63,12 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
...
@@ -66,10 +63,12 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
Optional
<
TaskContextInterface
>
optionalTc
=
p
.
updateExecution
(
t
);
Optional
<
TaskContextInterface
>
optionalTc
=
p
.
updateExecution
(
t
);
if
(
optionalTc
.
isPresent
())
{
if
(
optionalTc
.
isPresent
())
{
TaskContextInterface
tc
=
optionalTc
.
get
();
TaskContextInterface
tc
=
optionalTc
.
get
();
TerminationInfo
terminationInfo
=
new
TerminationInfo
(
tc
.
getReleaseTime
(),
tc
.
getDeadline
(),
t
);
schedulingInfo
.
addTerminationInfo
(
terminationInfo
);
if
(
t
>=
tc
.
getDeadline
())
{
if
(
t
>=
tc
.
getDeadline
())
{
TerminationInfo
terminationInfo
=
new
TerminationInfo
(
tc
.
getReleaseTime
(),
tc
.
getDeadline
(),
t
);
schedulingInfo
.
addTerminationInfo
(
terminationInfo
);
EventPrinter
.
print
(
"Time "
+
t
+
": Task "
+
tc
+
" failed its deadline!"
);
EventPrinter
.
print
(
"Time "
+
t
+
": Task "
+
tc
+
" failed its deadline!"
);
schedulingInfo
.
setFailedTerminationInfo
(
terminationInfo
);
schedulingInfo
.
setFailedTerminationInfo
(
terminationInfo
);
return
schedulingInfo
;
return
schedulingInfo
;
...
@@ -83,12 +82,12 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
...
@@ -83,12 +82,12 @@ public abstract class AbstractSimulator implements SimulatorInterface, TypeInter
return
schedulingInfo
;
return
schedulingInfo
;
}
}
private
void
init
(
PriorityManager
priorityManager
)
{
private
long
init
(
PriorityManager
priorityManager
)
{
this
.
readyTasks
=
TreeMultiset
.
create
((
t1
,
t2
)
->
priorityManager
.
compare
(
t1
,
t2
));
this
.
readyTasks
=
TreeMultiset
.
create
((
t1
,
t2
)
->
priorityManager
.
compare
(
t1
,
t2
));
for
(
ProcessorContext
p
:
processors
)
{
for
(
ProcessorContext
p
:
processors
)
{
p
.
setJob
(
null
);
p
.
setJob
(
null
);
}
}
this
.
hyperPeriod
=
getHyperPeriod
();
return
getHyperPeriod
();
}
}
private
Set
<
ProcessorContext
>
sortProcessors
(
Set
<
ProcessorContext
>
processors
)
{
private
Set
<
ProcessorContext
>
sortProcessors
(
Set
<
ProcessorContext
>
processors
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/
SchmidMottok
.java
→
src/main/java/mvd/jester/simulator/
DynamicForkJoin
.java
View file @
a9eacf10
...
@@ -3,14 +3,14 @@ package mvd.jester.simulator;
...
@@ -3,14 +3,14 @@ package mvd.jester.simulator;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskContext
;
/**
/**
* SchmidMottok
* SchmidMottok
*/
*/
public
class
SchmidMottok
extends
AbstractSimulator
{
public
class
DynamicForkJoin
extends
AbstractSimulator
{
public
SchmidMottok
(
SystemSetup
systemSetup
)
{
public
DynamicForkJoin
(
SystemSetup
systemSetup
)
{
super
(
systemSetup
);
super
(
systemSetup
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/
MaiaBertogna
.java
→
src/main/java/mvd/jester/simulator/
ParallelSynchronous
.java
View file @
a9eacf10
...
@@ -2,14 +2,14 @@ package mvd.jester.simulator;
...
@@ -2,14 +2,14 @@ package mvd.jester.simulator;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.internals.
maiabertogna
.TaskContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.TaskContext
;
/**
/**
* MaiaBertogna
* MaiaBertogna
*/
*/
public
class
MaiaBertogna
extends
AbstractSimulator
{
public
class
ParallelSynchronous
extends
AbstractSimulator
{
public
MaiaBertogna
(
SystemSetup
systemSetup
)
{
public
ParallelSynchronous
(
SystemSetup
systemSetup
)
{
super
(
systemSetup
);
super
(
systemSetup
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
schmidmottok
/JobContext.java
→
src/main/java/mvd/jester/simulator/internals/
dynamicforkjoin
/JobContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
internals
.
dynamicforkjoin
;
import
java.util.Optional
;
import
java.util.Optional
;
import
mvd.jester.simulator.EventPrinter
;
import
mvd.jester.simulator.EventPrinter
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
schmidmottok
/SegmentContext.java
→
src/main/java/mvd/jester/simulator/internals/
dynamicforkjoin
/SegmentContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
internals
.
dynamicforkjoin
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Optional
;
import
java.util.Optional
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
schmidmottok
/TaskContext.java
→
src/main/java/mvd/jester/simulator/internals/
dynamicforkjoin
/TaskContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
internals
.
dynamicforkjoin
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Optional
;
import
java.util.Optional
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
schmidmottok
/TaskletContext.java
→
src/main/java/mvd/jester/simulator/internals/
dynamicforkjoin
/TaskletContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
internals
.
dynamicforkjoin
;
import
java.util.Optional
;
import
java.util.Optional
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
maiabertogna
/JobContext.java
→
src/main/java/mvd/jester/simulator/internals/
parallelsynchronous
/JobContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
internals
.
parallelsynchronous
;
import
java.util.Optional
;
import
java.util.Optional
;
import
mvd.jester.simulator.EventPrinter
;
import
mvd.jester.simulator.EventPrinter
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
maiabertogna
/SegmentContext.java
→
src/main/java/mvd/jester/simulator/internals/
parallelsynchronous
/SegmentContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
internals
.
parallelsynchronous
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Optional
;
import
java.util.Optional
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/simulator/internals/
maiabertogna
/TaskContext.java
→
src/main/java/mvd/jester/simulator/internals/
parallelsynchronous
/TaskContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
internals
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
internals
.
parallelsynchronous
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -20,7 +20,6 @@ public class TaskContext implements TaskContextInterface {
...
@@ -20,7 +20,6 @@ public class TaskContext implements TaskContextInterface {
private
int
currentSegment
;
private
int
currentSegment
;
private
int
segmentCounter
;
private
int
segmentCounter
;
public
TaskContext
(
Task
task
,
long
releaseTime
)
{
public
TaskContext
(
Task
task
,
long
releaseTime
)
{
this
.
task
=
task
;
this
.
task
=
task
;
this
.
segments
=
new
ArrayList
<>();
this
.
segments
=
new
ArrayList
<>();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/AbstractTest.java
View file @
a9eacf10
...
@@ -2,7 +2,6 @@ package mvd.jester.tests;
...
@@ -2,7 +2,6 @@ package mvd.jester.tests;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
mvd.jester.TypeInterface
;
import
mvd.jester.TypeInterface
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
...
@@ -15,12 +14,10 @@ public abstract class AbstractTest implements TestInterface, TypeInterface {
...
@@ -15,12 +14,10 @@ public abstract class AbstractTest implements TestInterface, TypeInterface {
protected
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
protected
final
Map
<
Task
,
TerminationInfo
>
responseTimes
;
protected
final
SystemSetup
systemSetup
;
protected
final
SystemSetup
systemSetup
;
protected
Set
<
Task
>
tasks
;
public
AbstractTest
(
SystemSetup
systemSetup
)
{
public
AbstractTest
(
SystemSetup
systemSetup
)
{
this
.
systemSetup
=
systemSetup
;
this
.
systemSetup
=
systemSetup
;
this
.
responseTimes
=
new
HashMap
<>();
this
.
responseTimes
=
new
HashMap
<>();
this
.
tasks
=
systemSetup
.
getTasks
();
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/ChwaLee.java
View file @
a9eacf10
...
@@ -5,9 +5,11 @@ import java.util.ArrayList;
...
@@ -5,9 +5,11 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
com.google.common.math.LongMath
;
import
com.google.common.math.LongMath
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo.Level
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
...
@@ -25,19 +27,20 @@ public class ChwaLee extends AbstractTest {
...
@@ -25,19 +27,20 @@ public class ChwaLee extends AbstractTest {
@Override
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
tasks
=
new
SortedTaskSet
(
priorityManager
);
SortedTaskSet
tasks
=
new
SortedTaskSet
(
priorityManager
);
tasks
.
addAll
(
systemSetup
.
getTasks
());
tasks
.
addAll
(
systemSetup
.
getTasks
());
responseTimes
.
clear
();
responseTimes
.
clear
();
for
(
Task
t
:
tasks
)
{
for
(
Task
t
:
tasks
)
{
long
responseTime
=
calculateResponseTime
(
t
);
Level
taskLevel
=
tasks
.
headSet
(
t
).
size
()
<=
tasks
.
size
()
/
2
?
Level
.
HIGH
:
Level
.
LOW
;
responseTimes
.
put
(
t
,
new
TerminationInfo
(
0
,
t
.
getDeadline
(),
responseTime
));
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
,
taskLevel
));
}
}
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
systemSetup
.
getParallelTaskRatio
(),
systemSetup
.
getUtilization
());
systemSetup
.
getParallelTaskRatio
(),
systemSetup
.
getUtilization
());
}
}
private
long
calculateResponseTime
(
Task
task
)
{
private
long
calculateResponseTime
(
Set
<
Task
>
tasks
,
Task
task
)
{
long
minimumWcet
=
getMinimumWcet
(
task
);
long
minimumWcet
=
getMinimumWcet
(
task
);
long
deadline
=
task
.
getDeadline
();
long
deadline
=
task
.
getDeadline
();
long
numberOfProcessors
=
systemSetup
.
getNumberOfProcessors
();
long
numberOfProcessors
=
systemSetup
.
getNumberOfProcessors
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/MaiaBertogna.java
View file @
a9eacf10
...
@@ -2,9 +2,11 @@ package mvd.jester.tests;
...
@@ -2,9 +2,11 @@ package mvd.jester.tests;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
com.google.common.math.LongMath
;
import
com.google.common.math.LongMath
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo.Level
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
...
@@ -22,12 +24,13 @@ public class MaiaBertogna extends AbstractTest {
...
@@ -22,12 +24,13 @@ public class MaiaBertogna extends AbstractTest {
@Override
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
tasks
=
new
SortedTaskSet
(
priorityManager
);
SortedTaskSet
tasks
=
new
SortedTaskSet
(
priorityManager
);
tasks
.
addAll
(
systemSetup
.
getTasks
());
tasks
.
addAll
(
systemSetup
.
getTasks
());
responseTimes
.
clear
();
responseTimes
.
clear
();
for
(
Task
t
:
tasks
)
{
for
(
Task
t
:
tasks
)
{
long
responseTime
=
calculateResponseTime
(
t
);
Level
taskLevel
=
tasks
.
headSet
(
t
).
size
()
<=
tasks
.
size
()
/
2
?
Level
.
HIGH
:
Level
.
LOW
;
responseTimes
.
put
(
t
,
new
TerminationInfo
(
0
,
t
.
getDeadline
(),
responseTime
));
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
,
taskLevel
));
}
}
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
...
@@ -39,7 +42,7 @@ public class MaiaBertogna extends AbstractTest {
...
@@ -39,7 +42,7 @@ public class MaiaBertogna extends AbstractTest {
return
"MaiaBertogna"
;
return
"MaiaBertogna"
;
}
}
private
long
calculateResponseTime
(
Task
task
)
{
private
long
calculateResponseTime
(
Set
<
Task
>
tasks
,
Task
task
)
{
long
minimumWcet
=
getMinimumWcet
(
task
);
long
minimumWcet
=
getMinimumWcet
(
task
);
long
responseTime
=
minimumWcet
;
long
responseTime
=
minimumWcet
;
long
previousResponseTime
=
0
;
long
previousResponseTime
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
a9eacf10
...
@@ -2,9 +2,11 @@ package mvd.jester.tests;
...
@@ -2,9 +2,11 @@ package mvd.jester.tests;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
com.google.common.math.LongMath
;
import
com.google.common.math.LongMath
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo.Level
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
...
@@ -22,12 +24,13 @@ public class SchmidMottok extends AbstractTest {
...
@@ -22,12 +24,13 @@ public class SchmidMottok extends AbstractTest {
@Override
@Override
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
public
SchedulingInfo
runSchedulabilityCheck
(
PriorityManager
priorityManager
)
{
tasks
=
new
SortedTaskSet
(
priorityManager
);
SortedTaskSet
tasks
=
new
SortedTaskSet
(
priorityManager
);
tasks
.
addAll
(
systemSetup
.
getTasks
());
tasks
.
addAll
(
systemSetup
.
getTasks
());
responseTimes
.
clear
();
responseTimes
.
clear
();
for
(
Task
t
:
tasks
)
{
for
(
Task
t
:
tasks
)
{
long
responseTime
=
calculateResponseTime
(
t
);
Level
taskLevel
=
tasks
.
headSet
(
t
).
size
()
<=
tasks
.
size
()
/
2
?
Level
.
HIGH
:
Level
.
LOW
;
responseTimes
.
put
(
t
,
new
TerminationInfo
(
0
,
t
.
getDeadline
(),
responseTime
));
long
responseTime
=
calculateResponseTime
(
tasks
,
t
);
responseTimes
.
put
(
t
,
new
TerminationInfo
(
t
.
getDeadline
(),
responseTime
,
taskLevel
));
}
}
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
return
new
SchedulingInfo
(
new
HashSet
<>(
responseTimes
.
values
()),
...
@@ -39,7 +42,7 @@ public class SchmidMottok extends AbstractTest {
...
@@ -39,7 +42,7 @@ public class SchmidMottok extends AbstractTest {
return
"SchmidMottok"
;
return
"SchmidMottok"
;
}
}
private
long
calculateResponseTime
(
Task
task
)
{
private
long
calculateResponseTime
(
Set
<
Task
>
tasks
,
Task
task
)
{
long
minimumWcet
=
getMinimumWcet
(
task
);
long
minimumWcet
=
getMinimumWcet
(
task
);
long
responseTime
=
minimumWcet
;
long
responseTime
=
minimumWcet
;
long
previousResponseTime
=
0
;
long
previousResponseTime
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/mvd/jester/utils/Logger.java
View file @
a9eacf10
...
@@ -31,10 +31,10 @@ public class Logger {
...
@@ -31,10 +31,10 @@ public class Logger {
public
void
finalize
()
{
public
void
finalize
()
{
try
{
try
{
if
(
printWriter
!=
null
)
{
if
(
printWriter
!=
null
)
{
printWriter
.
close
();
// Will close bw and fw too
printWriter
.
close
();
}
}
if
(
bufferedWriter
!=
null
)
{
if
(
bufferedWriter
!=
null
)
{
bufferedWriter
.
close
();
// Will close fw too
bufferedWriter
.
close
();
}
}
if
(
fileWriter
!=
null
)
{
if
(
fileWriter
!=
null
)
{
fileWriter
.
close
();
fileWriter
.
close
();
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/TestResultCollector.java
0 → 100644
View file @
a9eacf10
package
mvd
.
jester
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.concurrent.ThreadLocalRandom
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.priority.PriorityManager
;
/**
* TestResultCollector
*/
public
class
TestResultCollector
{
@Test
@DisplayName
(
"Test if getters and setters work correctly."
)
void
testGettersAndSetters
()
{
final
PriorityManager
pm
=
mock
(
PriorityManager
.
class
);
final
String
pmName
=
"PriorityManagerName"
;
when
(
pm
.
getName
()).
thenReturn
(
pmName
);
final
TypeInterface
ti
=
mock
(
TypeInterface
.
class
);
final
String
tiName
=
"TypeInterfaceName"
;
when
(
ti
.
getName
()).
thenReturn
(
tiName
);
final
ResultCollector
<
TypeInterface
>
rc1
=
new
ResultCollector
<>(
pm
,
ti
);
final
ResultCollector
<
TypeInterface
>
rc2
=
new
ResultCollector
<>(
pm
,
ti
);
assertTrue
(
rc1
.
getPriorityManager
()
==
pm
);
assertTrue
(
rc1
.
getAbstractValue
()
==
ti
);
assertTrue
(
rc1
.
getName
().
equals
(
tiName
+
"_"
+
pmName
));
assertTrue
(
rc1
.
compareTo
(
rc2
)
==
0
);
}
@Test
@DisplayName
(
"Check if adding SchedulingInfos works correctly."
)
void
testSchedulingInfos
()
{
final
TypeInterface
ti
=
mock
(
TypeInterface
.
class
);
final
PriorityManager
pm
=
mock
(
PriorityManager
.
class
);
final
ResultCollector
<
TypeInterface
>
rc
=
new
ResultCollector
<>(
pm
,
ti
);
final
Set
<
SchedulingInfo
>
schedulingInfos
=
new
HashSet
<>();
long
numberOfSchedulingInfos
=
ThreadLocalRandom
.
current
().
nextLong
(
5
,
10
);
for
(
int
i
=
0
;
i
<
numberOfSchedulingInfos
;
++
i
)
{
SchedulingInfo
si
=
mock
(
SchedulingInfo
.
class
);
schedulingInfos
.
add
(
si
);
assertTrue
(
rc
.
addResult
(
si
));
assertFalse
(
rc
.
addResult
(
si
));
}
assertTrue
(
rc
.
getResults
().
size
()
==
numberOfSchedulingInfos
);
assertTrue
(
rc
.
getResults
().
equals
(
schedulingInfos
));
assertTrue
(
rc
.
addResult
(
null
));
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/info/TestSchedulingInfo.java
0 → 100644
View file @
a9eacf10
package
mvd
.
jester
.
info
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.concurrent.ThreadLocalRandom
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.info.TerminationInfo.Level
;
/**
* TestTerminationInfo
*/
public
class
TestSchedulingInfo
{
@Test
@DisplayName
(
"Check if SchedulingInfos parameters are calculated correctly."
)
public
void
testSchedulingInfo
()
{
for
(
int
run
=
0
;
run
<
1000
;
++
run
)
{
Set
<
TerminationInfo
>
terminationInfos
=
new
HashSet
<>();
int
numberOfTerminationInfos
=
ThreadLocalRandom
.
current
().
nextInt
(
5
,
10
);
boolean
feasibile
=
true
;
boolean
levelFailed
=
false
;
for
(
int
i
=
0
;
i
<
numberOfTerminationInfos
;
++
i
)
{
long
deadline
=
ThreadLocalRandom
.
current
().
nextLong
(
50
,
100
);
long
responseTime
=
ThreadLocalRandom
.
current
().
nextLong
(
50
,
100
);
Level
taskLevel
=
ThreadLocalRandom
.
current
().
nextLong
(
0
,
100
)
<
50
?
Level
.
LOW
:
Level
.
HIGH
;
terminationInfos
.
add
(
new
TerminationInfo
(
deadline
,
responseTime
,
taskLevel
));
if
(
deadline
<
responseTime
)
{
feasibile
=
false
;
if
(
taskLevel
==
Level
.
HIGH
)
{
levelFailed
=
true
;
}
}
}
SchedulingInfo
schedulingInfo
=
new
SchedulingInfo
(
terminationInfos
,
2
,
numberOfTerminationInfos
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
levelFailed
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
feasibile
);
}
}
@Test
@DisplayName
(
"Check Getters and Setters."
)
public
void
testGettersAndSetters
()
{
double
taskRatio
=
0.23
;
double
utilization
=
0.49
;
SchedulingInfo
si
=
new
SchedulingInfo
(
taskRatio
,
utilization
);
Set
<
TerminationInfo
>
terminationInfos
=
new
HashSet
<>();
long
numberOfTerminationInfos
=
ThreadLocalRandom
.
current
().
nextLong
(
5
,
10
);
for
(
int
i
=
0
;
i
<
numberOfTerminationInfos
;
++
i
)
{
TerminationInfo
ti
=
mock
(
TerminationInfo
.
class
);
terminationInfos
.
add
(
ti
);
assertTrue
(
si
.
addTerminationInfo
(
ti
));
assertFalse
(
si
.
addTerminationInfo
(
ti
));
}
assertTrue
(
si
.
getParallelTaskRatio
()
==
taskRatio
);
assertTrue
(
si
.
getUtilization
()
==
utilization
);
assertTrue
(
si
.
getTerminationInfos
().
size
()
==
numberOfTerminationInfos
);
assertTrue
(
si
.
getTerminationInfos
().
equals
(
terminationInfos
));
assertTrue
(
si
.
addTerminationInfo
(
null
));
assertFalse
(
si
.
getFailedTerminationInfo
().
isPresent
());
TerminationInfo
ti
=
mock
(
TerminationInfo
.
class
);
si
.
setFailedTerminationInfo
(
ti
);
assertTrue
(
si
.
getFailedTerminationInfo
().
isPresent
());
assertTrue
(
si
.
getFailedTerminationInfo
().
get
().
equals
(
ti
));
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/info/TestTerminationInfo.java
0 → 100644
View file @
a9eacf10
package
mvd
.
jester
.
info
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.info.TerminationInfo.Level
;
/**
* TestTerminationInfo
*/
public
class
TestTerminationInfo
{
@Test
@DisplayName
(
"Check Getters and Setters"
)
public
void
testGettersAndSetters
()
{
long
releaseTime
=
20
;
long
deadline
=
40
;
long
responseTime
=
30
;
Level
taskLevel
=
Level
.
LOW
;
TerminationInfo
ti
=
new
TerminationInfo
(
releaseTime
,
deadline
,
responseTime
);
TerminationInfo
til
=
new
TerminationInfo
(
deadline
,
responseTime
,
taskLevel
);
TerminationInfo
tirl
=
new
TerminationInfo
(
releaseTime
,
deadline
,
responseTime
,
taskLevel
);
assertTrue
(
ti
.
getDeadline
()
==
deadline
);
assertTrue
(
til
.
getDeadline
()
==
deadline
);
assertTrue
(
tirl
.
getDeadline
()
==
deadline
);
assertTrue
(
ti
.
getResponseTime
()
==
responseTime
);
assertTrue
(
til
.
getResponseTime
()
==
responseTime
);
assertTrue
(
tirl
.
getResponseTime
()
==
responseTime
);
assertTrue
(
ti
.
getReleaseTime
()
==
releaseTime
);
assertTrue
(
tirl
.
getReleaseTime
()
==
releaseTime
);
assertTrue
(
til
.
getTaskLevel
()
==
taskLevel
);
assertTrue
(
tirl
.
getTaskLevel
()
==
taskLevel
);
assertTrue
(
ti
.
getLateness
()
==
responseTime
-
deadline
);
assertTrue
(
til
.
getLateness
()
==
responseTime
-
deadline
);
assertTrue
(
tirl
.
getLateness
()
==
responseTime
-
deadline
);
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/model/TestSystemSetup.java
View file @
a9eacf10
package
mvd
.
jester
.
model
;
package
mvd
.
jester
.
model
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
java.io.IOException
;
import
java.util.Set
;
import
java.util.concurrent.ThreadLocalRandom
;
import
org.junit.Rule
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.rules.TemporaryFolder
;
public
class
TestSystemSetup
{
public
class
TestSystemSetup
{
@Rule
public
TemporaryFolder
tf
=
new
TemporaryFolder
();
private
static
final
int
NUMBER_OF_
SET
S
=
1000
;
private
static
final
int
NUMBER_OF_
RUN
S
=
1000
;
@Test
@Test
@DisplayName
(
"Check if randomly generated task parameters lie within the specified ranges."
)
@DisplayName
(
"Check if randomly generated task parameters lie within the specified ranges."
)
public
void
testRandomTaskSetGeneration
()
{
public
void
testRandomTaskSetGeneration
()
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_SETS
;
++
i
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_RUNS
;
++
i
)
{
SystemSetup
taskSet
=
new
SystemSetup
.
Builder
().
setNumberOfSegments
(
1
,
7
)
long
numberOfProcessors
=
ThreadLocalRandom
.
current
().
nextLong
(
2
,
8
);
.
setNumberOfJobs
(
2
,
10
).
setPeriods
(
100
,
1000
,
1000
).
build
();
SystemSetup
.
Builder
systemSetupBuilder
=
new
SystemSetup
.
Builder
()
//
.
setNumberOfSegments
(
1
,
7
)
//
.
setNumberOfJobs
(
2
,
10
)
//
.
setPeriods
(
100
,
1000
,
1000
)
//
.
setNumberOfProcessors
(
numberOfProcessors
);
for
(
Task
t
:
taskSet
.
getTasks
())
{
SystemSetup
systemSetup
=
systemSetupBuilder
.
build
();
assertTrue
(
systemSetup
.
getNumberOfProcessors
()
==
numberOfProcessors
);
for
(
Task
t
:
systemSetup
.
getTasks
())
{
assertTrue
(
t
.
getPeriod
()
>=
100
);
assertTrue
(
t
.
getPeriod
()
>=
100
);
assertTrue
(
t
.
getPeriod
()
<=
1000
);
assertTrue
(
t
.
getPeriod
()
<=
1000
);
assertTrue
(
t
.
getDeadline
()
==
t
.
getPeriod
());
assertTrue
(
t
.
getDeadline
()
==
t
.
getPeriod
());
...
@@ -35,8 +52,39 @@ public class TestSystemSetup {
...
@@ -35,8 +52,39 @@ public class TestSystemSetup {
assertTrue
(
t
.
getSegments
().
size
()
>=
1
);
assertTrue
(
t
.
getSegments
().
size
()
>=
1
);
assertTrue
(
t
.
getSegments
().
size
()
<=
7
);
assertTrue
(
t
.
getSegments
().
size
()
<=
7
);
}
}
assertTrue
(
systemSetupBuilder
.
addTask
(
systemSetup
));
Set
<
Task
>
tasks
=
systemSetup
.
getTasks
();
systemSetupBuilder
.
rebuild
(
systemSetup
);
assertFalse
(
tasks
==
systemSetup
.
getTasks
());
}
}
}
@Test
@DisplayName
(
"Check Getters and Setters."
)
void
testGettersAndSetters
()
{
@SuppressWarnings
(
"unchecked"
)
Set
<
Task
>
t1
=
mock
(
Set
.
class
);
@SuppressWarnings
(
"unchecked"
)
Set
<
Task
>
t2
=
mock
(
Set
.
class
);
SystemSetup
systemSetup
=
new
SystemSetup
(
t1
,
2
);
systemSetup
.
setTasks
(
t2
);
assertTrue
(
systemSetup
.
getTasks
()
==
t2
);
}
}
// @Test
// @DisplayName("Check if parser works correclty.")
// void testParser() throws IOException {
// SystemSetup systemSetup = new SystemSetup.Builder().setNumberOfSegments(1, 7)
// .setNumberOfJobs(2, 10).setPeriods(100, 1000, 1000).build();
// systemSetup.writeToFile(null);
// systemSetup.writeToFile(tf.getRoot().getAbsolutePath());
// }
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/priority/TestEarliestDeadlineFirst.java
View file @
a9eacf10
package
mvd
.
jester
.
priority
;
package
mvd
.
jester
.
priority
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
java.util.HashSet
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.internals.maiabertogna.TaskContext
;
import
mvd.jester.simulator.DynamicForkJoin
;
import
mvd.jester.simulator.ParallelSynchronous
;
import
mvd.jester.simulator.internals.parallelsynchronous.TaskContext
;
import
mvd.jester.tests.ChwaLee
;
import
mvd.jester.tests.MaiaBertogna
;
import
mvd.jester.tests.SchmidMottok
;
/**
/**
* TestEarliestDeadlineFirst
* TestEarliestDeadlineFirst
...
@@ -16,13 +24,43 @@ public class TestEarliestDeadlineFirst {
...
@@ -16,13 +24,43 @@ public class TestEarliestDeadlineFirst {
@DisplayName
(
"Test if priority manager returns the correct priority."
)
@DisplayName
(
"Test if priority manager returns the correct priority."
)
public
void
testPriority
()
{
public
void
testPriority
()
{
EarliestDeadlineFirst
edf
=
new
EarliestDeadlineFirst
();
EarliestDeadlineFirst
edf
=
new
EarliestDeadlineFirst
();
Task
t1
=
new
Task
(
100
,
new
HashSet
<>());
Task
t2
=
new
Task
(
200
,
new
HashSet
<>());
TaskContext
tc1
=
new
TaskContext
(
t1
,
0
);
Task
t1
=
mock
(
Task
.
class
);
TaskContext
tc2
=
new
TaskContext
(
t2
,
0
);
Task
t2
=
mock
(
Task
.
class
);
when
(
t1
.
getDeadline
()).
thenReturn
((
long
)
100
);
when
(
t2
.
getDeadline
()).
thenReturn
((
long
)
200
);
TaskContext
tc1
=
mock
(
TaskContext
.
class
);
TaskContext
tc2
=
mock
(
TaskContext
.
class
);
when
(
tc1
.
getDeadline
()).
thenReturn
((
long
)
100
);
when
(
tc2
.
getDeadline
()).
thenReturn
((
long
)
200
);
assertTrue
(
edf
.
compare
(
t1
,
t2
)
<
0
);
assertTrue
(
edf
.
compare
(
t1
,
t2
)
<
0
);
assertTrue
(
edf
.
compare
(
tc1
,
tc2
)
<
0
);
assertTrue
(
edf
.
compare
(
tc1
,
tc2
)
<
0
);
assertTrue
(
edf
.
compare
(
t1
,
t1
)
==
0
);
assertTrue
(
edf
.
compare
(
tc1
,
tc1
)
==
0
);
assertTrue
(
edf
.
compare
(
t2
,
t1
)
>
0
);
assertTrue
(
edf
.
compare
(
tc2
,
tc1
)
>
0
);
}
}
@Test
@DisplayName
(
"Check Getters, Tests and Simulators."
)
void
testGettersTestsAndSimulators
()
{
EarliestDeadlineFirst
edf
=
new
EarliestDeadlineFirst
();
assertTrue
(
edf
.
hasTest
(
ChwaLee
.
class
));
assertFalse
(
edf
.
hasTest
(
MaiaBertogna
.
class
));
assertFalse
(
edf
.
hasTest
(
SchmidMottok
.
class
));
assertTrue
(
edf
.
hasSimulator
(
ParallelSynchronous
.
class
));
assertTrue
(
edf
.
hasSimulator
(
DynamicForkJoin
.
class
));
assertTrue
(
edf
.
hasTest
(
new
ChwaLee
(
mock
(
SystemSetup
.
class
))));
assertFalse
(
edf
.
hasTest
(
new
SchmidMottok
(
mock
(
SystemSetup
.
class
))));
assertFalse
(
edf
.
hasTest
(
new
MaiaBertogna
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
edf
.
hasSimulator
(
new
ParallelSynchronous
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
edf
.
hasSimulator
(
new
DynamicForkJoin
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
edf
.
getName
().
equals
(
"EDF"
));
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/priority/TestRateMonotonic.java
View file @
a9eacf10
package
mvd
.
jester
.
priority
;
package
mvd
.
jester
.
priority
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.internals.maiabertogna.TaskContext
;
import
mvd.jester.simulator.DynamicForkJoin
;
import
mvd.jester.simulator.ParallelSynchronous
;
import
mvd.jester.simulator.internals.parallelsynchronous.TaskContext
;
import
mvd.jester.tests.ChwaLee
;
import
mvd.jester.tests.MaiaBertogna
;
import
mvd.jester.tests.SchmidMottok
;
/**
/**
* TestRateMonotonic
* TestRateMonotonic
...
@@ -17,13 +26,41 @@ public class TestRateMonotonic {
...
@@ -17,13 +26,41 @@ public class TestRateMonotonic {
@DisplayName
(
"Test if priority manager returns the correct priority."
)
@DisplayName
(
"Test if priority manager returns the correct priority."
)
public
void
testPriority
()
{
public
void
testPriority
()
{
RateMonotonic
rm
=
new
RateMonotonic
();
RateMonotonic
rm
=
new
RateMonotonic
();
Task
t1
=
new
Task
(
100
,
new
HashSet
<
Segment
>());
Task
t1
=
mock
(
Task
.
class
);
Task
t2
=
new
Task
(
200
,
new
HashSet
<
Segment
>());
Task
t2
=
mock
(
Task
.
class
);
when
(
t1
.
getPeriod
()).
thenReturn
((
long
)
100
);
when
(
t2
.
getPeriod
()).
thenReturn
((
long
)
200
);
TaskContext
tc1
=
new
TaskContext
(
t1
,
0
);
TaskContext
tc1
=
mock
(
TaskContext
.
class
);
TaskContext
tc2
=
new
TaskContext
(
t2
,
0
);
TaskContext
tc2
=
mock
(
TaskContext
.
class
);
when
(
tc1
.
getTask
()).
thenReturn
(
t1
);
when
(
tc2
.
getTask
()).
thenReturn
(
t2
);
assertTrue
(
rm
.
compare
(
t1
,
t2
)
<
0
);
assertTrue
(
rm
.
compare
(
t1
,
t2
)
<
0
);
assertTrue
(
rm
.
compare
(
tc1
,
tc2
)
<
0
);
assertTrue
(
rm
.
compare
(
tc1
,
tc2
)
<
0
);
assertTrue
(
rm
.
compare
(
t1
,
t1
)
==
0
);
assertTrue
(
rm
.
compare
(
tc1
,
tc1
)
==
0
);
assertTrue
(
rm
.
compare
(
t2
,
t1
)
>
0
);
assertTrue
(
rm
.
compare
(
tc2
,
tc1
)
>
0
);
}
@Test
@DisplayName
(
"Check Tests and Simulators."
)
void
testTestsAndSimulators
()
{
RateMonotonic
rm
=
new
RateMonotonic
();
assertFalse
(
rm
.
hasTest
(
ChwaLee
.
class
));
assertTrue
(
rm
.
hasTest
(
MaiaBertogna
.
class
));
assertTrue
(
rm
.
hasTest
(
SchmidMottok
.
class
));
assertTrue
(
rm
.
hasSimulator
(
ParallelSynchronous
.
class
));
assertTrue
(
rm
.
hasSimulator
(
DynamicForkJoin
.
class
));
assertFalse
(
rm
.
hasTest
(
new
ChwaLee
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
rm
.
hasTest
(
new
SchmidMottok
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
rm
.
hasTest
(
new
MaiaBertogna
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
rm
.
hasSimulator
(
new
ParallelSynchronous
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
rm
.
hasSimulator
(
new
DynamicForkJoin
(
mock
(
SystemSetup
.
class
))));
assertTrue
(
rm
.
getName
().
equals
(
"RM"
));
}
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/TestProcessorContext.java
View file @
a9eacf10
...
@@ -17,8 +17,8 @@ import org.junit.jupiter.api.Test;
...
@@ -17,8 +17,8 @@ import org.junit.jupiter.api.Test;
import
mvd.jester.model.Task
;
import
mvd.jester.model.Task
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.
maiabertogna
.JobContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.JobContext
;
import
mvd.jester.simulator.internals.
maiabertogna
.TaskContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.TaskContext
;
/**
/**
* TestProcessorContext
* TestProcessorContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
schmidmottok
/TestJobContext.java
→
src/test/java/mvd/jester/simulator/
dynamicforkjoin
/TestJobContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
dynamicforkjoin
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
...
@@ -14,10 +14,10 @@ import org.junit.jupiter.api.DisplayName;
...
@@ -14,10 +14,10 @@ import org.junit.jupiter.api.DisplayName;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.JobContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.JobContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.SegmentContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.SegmentContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskletContext
;;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskletContext
;;
/**
/**
* TestJobContext
* TestJobContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
schmidmottok
/TestSegmentContext.java
→
src/test/java/mvd/jester/simulator/
dynamicforkjoin
/TestSegmentContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
dynamicforkjoin
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
...
@@ -11,10 +11,10 @@ import org.junit.jupiter.api.Test;
...
@@ -11,10 +11,10 @@ import org.junit.jupiter.api.Test;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.JobContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.JobContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.SegmentContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.SegmentContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskletContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskletContext
;
/**
/**
* TestSegmentContext
* TestSegmentContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
schmidmottok
/TestTaskContext.java
→
src/test/java/mvd/jester/simulator/
dynamicforkjoin
/TestTaskContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
dynamicforkjoin
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
...
@@ -14,7 +14,7 @@ import mvd.jester.model.Task;
...
@@ -14,7 +14,7 @@ import mvd.jester.model.Task;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskContext
;
/**
/**
* TestTaskContext
* TestTaskContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
schmidmottok
/TestTaskletContext.java
→
src/test/java/mvd/jester/simulator/
dynamicforkjoin
/TestTaskletContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
schmidmottok
;
package
mvd
.
jester
.
simulator
.
dynamicforkjoin
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
...
@@ -11,10 +11,10 @@ import java.util.concurrent.ThreadLocalRandom;
...
@@ -11,10 +11,10 @@ import java.util.concurrent.ThreadLocalRandom;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.simulator.internals.
schmidmottok
.JobContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.JobContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.SegmentContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.SegmentContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskContext
;
import
mvd.jester.simulator.internals.
schmidmottok
.TaskletContext
;
import
mvd.jester.simulator.internals.
dynamicforkjoin
.TaskletContext
;
/**
/**
* TestTaskletContext
* TestTaskletContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
maiabertogna
/TestJobContext.java
→
src/test/java/mvd/jester/simulator/
parallelsynchronous
/TestJobContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
parallelsynchronous
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
...
@@ -15,9 +15,9 @@ import org.junit.jupiter.api.Test;
...
@@ -15,9 +15,9 @@ import org.junit.jupiter.api.Test;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.
maiabertogna
.JobContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.JobContext
;
import
mvd.jester.simulator.internals.
maiabertogna
.SegmentContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.SegmentContext
;
import
mvd.jester.simulator.internals.
maiabertogna
.TaskContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.TaskContext
;
/**
/**
* TestJobContext
* TestJobContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
maiabertogna
/TestSegmentContext.java
→
src/test/java/mvd/jester/simulator/
parallelsynchronous
/TestSegmentContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
parallelsynchronous
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
...
@@ -10,8 +10,8 @@ import org.junit.jupiter.api.DisplayName;
...
@@ -10,8 +10,8 @@ import org.junit.jupiter.api.DisplayName;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.model.Segment
;
import
mvd.jester.model.Segment
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.
maiabertogna
.SegmentContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.SegmentContext
;
import
mvd.jester.simulator.internals.
maiabertogna
.TaskContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.TaskContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/simulator/
maiabertogna
/TestTaskContext.java
→
src/test/java/mvd/jester/simulator/
parallelsynchronous
/TestTaskContext.java
View file @
a9eacf10
package
mvd
.
jester
.
simulator
.
maiabertogna
;
package
mvd
.
jester
.
simulator
.
parallelsynchronous
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
...
@@ -14,7 +14,7 @@ import mvd.jester.model.Task;
...
@@ -14,7 +14,7 @@ import mvd.jester.model.Task;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.JobContextInterface
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.ProcessorContext
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.TaskContextInterface
;
import
mvd.jester.simulator.internals.
maiabertogna
.TaskContext
;
import
mvd.jester.simulator.internals.
parallelsynchronous
.TaskContext
;
/**
/**
* TestTaskContext
* TestTaskContext
...
...
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/tests/TestMaiaBertogna.java
View file @
a9eacf10
package
mvd
.
jester
.
tests
;
package
mvd
.
jester
.
tests
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo.Level
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.RateMonotonic
;
/**
/**
* TestMaiaBertogna
* TestMaiaBertogna
...
@@ -12,7 +16,41 @@ public class TestMaiaBertogna {
...
@@ -12,7 +16,41 @@ public class TestMaiaBertogna {
@Test
@Test
@DisplayName
(
"Check if the schedulability check returns the correct values."
)
@DisplayName
(
"Check if the schedulability check returns the correct values."
)
public
void
testRunSchedulabilityCheck
()
{
public
void
testRunSchedulabilityCheck
()
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"/resources/Taskset1.txt"
,
0
);
{
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
4
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
true
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
false
);
assertTrue
(
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
8
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
true
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
false
);
assertTrue
(
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
16
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
false
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
true
);
assertTrue
(!
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
}
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/mvd/jester/tests/TestSchmidMottok.java
0 → 100644
View file @
a9eacf10
package
mvd
.
jester
.
tests
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo.Level
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.RateMonotonic
;
/**
* TestSchmidMottok
*/
public
class
TestSchmidMottok
{
@Test
@DisplayName
(
"Check if the schedulability check returns the correct values."
)
public
void
testRunSchedulabilityCheck
()
{
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
4
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
true
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
false
);
assertTrue
(
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
8
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
true
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
false
);
assertTrue
(
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
{
SystemSetup
systemSetup
=
SystemSetup
.
readFromFile
(
"src/test/resources/Taskset1.txt"
,
16
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
SchedulingInfo
schedulingInfo
=
mb
.
runSchedulabilityCheck
(
new
RateMonotonic
());
assertTrue
(
schedulingInfo
.
getTerminationInfos
().
size
()
==
4
);
assertTrue
(
schedulingInfo
.
checkLevelFail
(
Level
.
HIGH
)
==
false
);
assertTrue
(
schedulingInfo
.
checkTasksetFeasible
()
==
true
);
assertTrue
(!
schedulingInfo
.
getFailedTerminationInfo
().
isPresent
());
}
}
}
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