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
d255848d
authored
Jan 16, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed logging tools and added Chwa test
parent
402173ef
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
527 additions
and
281 deletions
+527
-281
pom.xml
+6
-0
src/main/java/mvd/jester/App.java
+12
-5
src/main/java/mvd/jester/Pair.java
+0
-36
src/main/java/mvd/jester/ResultCollector.java
+33
-163
src/main/java/mvd/jester/ResultLogger.java
+226
-0
src/main/java/mvd/jester/TestEnvironment.java
+26
-45
src/main/java/mvd/jester/TypeInterface.java
+1
-3
src/main/java/mvd/jester/info/SchedulingInfo.java
+24
-3
src/main/java/mvd/jester/model/SystemSetup.java
+25
-11
src/main/java/mvd/jester/priority/EarliestDeadlineFirst.java
+15
-3
src/main/java/mvd/jester/priority/PriorityManager.java
+4
-0
src/main/java/mvd/jester/priority/RateMonotonic.java
+11
-0
src/main/java/mvd/jester/simulator/AbstractSimulator.java
+5
-4
src/main/java/mvd/jester/tests/AbstractTest.java
+2
-2
src/main/java/mvd/jester/tests/ChwaLee.java
+130
-0
src/main/java/mvd/jester/tests/MaiaBertogna.java
+2
-1
src/main/java/mvd/jester/tests/SchmidMottok.java
+2
-1
src/main/java/mvd/jester/utils/Logger.java
+2
-2
src/test/java/mvd/jester/priority/TestEarliestDeadlineFirst.java
+1
-2
No files found.
pom.xml
View file @
d255848d
...
...
@@ -48,6 +48,12 @@
<artifactId>
guava
</artifactId>
<version>
28.0-jre
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-csv
</artifactId>
<version>
1.7
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/mvd/jester/App.java
View file @
d255848d
...
...
@@ -3,6 +3,7 @@ package mvd.jester;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.EarliestDeadlineFirst
;
import
mvd.jester.priority.RateMonotonic
;
import
mvd.jester.tests.ChwaLee
;
/**
...
...
@@ -15,10 +16,11 @@ public class App {
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
40000
);
te
.
registerSchedulingAlgorithm
(
new
RateMonotonic
());
//
te.registerSchedulingAlgorithm(new EarliestDeadlineFirst());
te
.
registerSchedulingAlgorithm
(
new
EarliestDeadlineFirst
());
te
.
registerTest
(
mvd
.
jester
.
tests
.
SchmidMottok
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
ChwaLee
.
class
);
// te.registerSimulator(mvd.jester.simulator.MaiaBertogna.class);
// te.registerSimulator(mvd.jester.simulator.SchmidMottok.class);
...
...
@@ -26,9 +28,14 @@ public class App {
te
.
runTests
();
// SystemSetup ss = builder.build();
// builder.addTask(ss);
// builder.addTask(ss);
// ss.writeToFile("Test3.txt");
// 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);
}
}
src/main/java/mvd/jester/Pair.java
deleted
100644 → 0
View file @
402173ef
package
mvd
.
jester
;
import
mvd.jester.priority.PriorityManager
;
/**
* PriorityPair
*/
public
class
Pair
<
T
extends
PairInterface
>
{
private
final
PriorityManager
priorityManager
;
private
final
T
abstractValue
;
public
Pair
(
PriorityManager
priorityManager
,
T
abstractValue
)
{
this
.
abstractValue
=
abstractValue
;
this
.
priorityManager
=
priorityManager
;
}
/**
* @return the priorityManager
*/
public
PriorityManager
getPriorityManager
()
{
return
priorityManager
;
}
/**
* @return the abstractValue
*/
public
T
getAbstractValue
()
{
return
abstractValue
;
}
public
String
getName
()
{
return
abstractValue
.
getName
()
+
"_"
+
priorityManager
.
getName
();
}
}
src/main/java/mvd/jester/ResultCollector.java
View file @
d255848d
package
mvd
.
jester
;
import
java.time.LocalTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.HashSet
;
import
java.util.Set
;
import
com.google.common.collect.Table
;
import
com.google.common.math.Stats
;
import
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.utils.Logger
;
import
mvd.jester.priority.PriorityManager
;
/**
*
ResultCollecto
r
*
PriorityPai
r
*/
public
class
ResultCollector
{
private
final
Table
<
Long
,
Pair
<
AbstractTest
>,
Set
<
SchedulingInfo
>>
testResults
;
private
final
Table
<
Long
,
Pair
<
AbstractSimulator
>,
Set
<
SchedulingInfo
>>
simulatorResults
;
private
final
Map
<
Long
,
Long
>
totalNumberOfTasksets
;
private
final
long
numberOfProcessors
;
public
ResultCollector
(
Table
<
Long
,
Pair
<
AbstractTest
>,
Set
<
SchedulingInfo
>>
testResults
,
Table
<
Long
,
Pair
<
AbstractSimulator
>,
Set
<
SchedulingInfo
>>
simulatorResults
,
Map
<
Long
,
Long
>
totalNumberOfTasksets
,
long
numberOfProcessors
)
{
this
.
testResults
=
testResults
;
this
.
simulatorResults
=
simulatorResults
;
this
.
totalNumberOfTasksets
=
totalNumberOfTasksets
;
this
.
numberOfProcessors
=
numberOfProcessors
;
public
class
ResultCollector
<
T
extends
TypeInterface
>
implements
Comparable
<
ResultCollector
<?
extends
TypeInterface
>>
{
private
final
PriorityManager
priorityManager
;
private
final
T
abstractValue
;
private
final
Set
<
SchedulingInfo
>
schedulingInfos
;
public
ResultCollector
(
PriorityManager
priorityManager
,
T
abstractValue
)
{
this
.
abstractValue
=
abstractValue
;
this
.
priorityManager
=
priorityManager
;
this
.
schedulingInfos
=
new
HashSet
<>();
}
public
void
logAll
()
{
if
(!
testResults
.
isEmpty
())
{
logFeasibility
(
testResults
,
"test"
);
logFeasibilityRatio
(
testResults
,
"test"
);
logTardinessStatistics
(
testResults
,
"test"
);
logFailedTardiness
(
testResults
,
"test"
);
}
if
(!
simulatorResults
.
isEmpty
())
{
logFeasibility
(
simulatorResults
,
"sim"
);
logFeasibilityRatio
(
simulatorResults
,
"sim"
);
logTardinessStatistics
(
simulatorResults
,
"sim"
);
logFailedTardiness
(
simulatorResults
,
"sim"
);
}
/**
* @return the priorityManager
*/
public
PriorityManager
getPriorityManager
()
{
return
priorityManager
;
}
public
<
T
extends
PairInterface
>
void
logFeasibilityRatio
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/feasibility_ratio_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
firstLine
=
firstLine
+
"\t"
+
pair
.
getName
();
}
log
.
log
(
firstLine
);
for
(
Long
util
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
util
/
10
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
long
feasibleTasksets
=
results
.
get
(
util
,
pair
).
stream
()
.
filter
(
s
->
s
.
checkTasksetFeasible
()).
count
();
line
+=
"\t"
+
((
double
)
feasibleTasksets
/
totalNumberOfTasksets
.
get
(
util
));
}
log
.
log
(
line
);
}
}
log
.
finalize
();
/**
* @return the abstractValue
*/
public
T
getAbstractValue
()
{
return
abstractValue
;
}
public
<
T
extends
PairInterface
>
void
logFeasibility
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/feasibility_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
firstLine
=
firstLine
+
"\t"
+
pair
.
getName
();
}
log
.
log
(
firstLine
);
for
(
Long
util
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
util
/
10
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
long
feasibleTasksets
=
results
.
get
(
util
,
pair
).
stream
()
.
filter
(
s
->
s
.
checkTasksetFeasible
()).
count
();
line
+=
"\t"
+
feasibleTasksets
;
}
log
.
log
(
line
);
}
}
log
.
finalize
();
public
String
getName
()
{
return
abstractValue
.
getName
()
+
"_"
+
priorityManager
.
getName
();
}
public
<
T
extends
PairInterface
>
void
logFailedTardiness
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/failed_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
firstLine
=
firstLine
+
"\t"
+
pair
.
getName
();
}
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
kv
/
10
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
List
<
Long
>
values
=
new
ArrayList
<>();
for
(
SchedulingInfo
s
:
simulationInfos
)
{
Optional
<
TerminationInfo
>
failedTerminationInfo
=
s
.
getFailedTerminationInfo
();
if
(
failedTerminationInfo
.
isPresent
())
{
values
.
add
(
failedTerminationInfo
.
get
().
getLateness
());
}
}
double
meanTardiness
=
0
;
if
(!
values
.
isEmpty
())
{
meanTardiness
=
Stats
.
meanOf
(
values
.
iterator
());
}
line
+=
"\t"
+
meanTardiness
;
}
log
.
log
(
line
);
}
}
log
.
finalize
();
public
void
addResult
(
SchedulingInfo
schedulingInfo
)
{
this
.
schedulingInfos
.
add
(
schedulingInfo
);
}
public
<
T
extends
PairInterface
>
void
logTardinessStatistics
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/statistics_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
firstLine
=
firstLine
+
"\t"
+
pair
.
getName
();
}
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
kv
/
10
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
DescriptiveStatistics
stats
=
new
DescriptiveStatistics
();
for
(
SchedulingInfo
s
:
simulationInfos
)
{
for
(
TerminationInfo
t
:
s
.
getTerminationInfos
())
{
stats
.
addValue
(
t
.
getLateness
());
}
}
line
+=
"\t"
+
stats
.
getMean
();
}
log
.
log
(
line
);
}
}
log
.
finalize
();
public
Set
<
SchedulingInfo
>
getResults
()
{
return
schedulingInfos
;
}
@Override
public
int
compareTo
(
ResultCollector
<?
extends
TypeInterface
>
o
)
{
return
getName
().
compareTo
(
o
.
getName
());
}
}
src/main/java/mvd/jester/ResultLogger.java
0 → 100644
View file @
d255848d
package
mvd
.
jester
;
import
java.io.IOException
;
import
java.time.LocalTime
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ObjectArrays
;
import
com.google.common.collect.Table
;
import
com.google.common.collect.TreeBasedTable
;
import
org.apache.commons.csv.CSVFormat
;
import
org.apache.commons.csv.CSVPrinter
;
import
mvd.jester.tests.AbstractTest
;
import
mvd.jester.utils.Logger
;
/**
* ResultCollector
*/
public
class
ResultLogger
{
private
final
long
numberOfProcessors
;
public
ResultLogger
(
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
}
// public void logAll() {
// if (!testResults.isEmpty()) {
// logFeasibility(testResults, "test");
// logFeasibilityRatio(testResults, "test");
// logTardinessStatistics(testResults, "test");
// logFailedTardiness(testResults, "test");
// }
// if (!simulatorResults.isEmpty()) {
// logFeasibility(simulatorResults, "sim");
// logFeasibilityRatio(simulatorResults, "sim");
// logTardinessStatistics(simulatorResults, "sim");
// logFailedTardiness(simulatorResults, "sim");
// }
// }
public
void
logTests
(
Set
<
ResultCollector
<
AbstractTest
>>
results
)
{
logFeasibility
(
results
,
"test"
);
logTaskRatio
(
results
,
"test"
);
}
public
<
T
extends
TypeInterface
>
void
logFeasibility
(
Set
<
ResultCollector
<
T
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/feasibility_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
Table
<
Long
,
ResultCollector
<
T
>,
Long
>
resultTable
=
TreeBasedTable
.
create
();
Set
<
ResultCollector
<
T
>>
resultCollectors
=
new
TreeSet
<>();
for
(
ResultCollector
<
T
>
r
:
results
)
{
System
.
out
.
println
(
r
.
getName
()
+
": "
+
r
.
getResults
().
stream
().
filter
(
p
->
p
.
checkTasksetFeasible
()).
count
());
}
for
(
long
util
=
0
;
util
<
numberOfProcessors
*
10
;
util
++)
{
for
(
ResultCollector
<
T
>
rc
:
results
)
{
resultCollectors
.
add
(
rc
);
final
long
local_util
=
util
;
long
feasibleTasksets
=
rc
.
getResults
().
stream
()
.
filter
(
r
->
Math
.
round
(
r
.
getUtilization
()
*
10
)
==
local_util
)
.
filter
(
r
->
r
.
checkTasksetFeasible
()).
count
();
resultTable
.
put
(
util
,
rc
,
feasibleTasksets
);
}
}
logData
(
log
,
resultTable
,
resultCollectors
);
}
public
<
T
extends
TypeInterface
>
void
logTaskRatio
(
Set
<
ResultCollector
<
T
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/task_ratio_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
Table
<
Long
,
ResultCollector
<
T
>,
Long
>
resultTable
=
TreeBasedTable
.
create
();
Set
<
ResultCollector
<
T
>>
resultCollectors
=
new
TreeSet
<>();
for
(
long
ratio
=
0
;
ratio
<
10
;
ratio
+=
1
)
{
for
(
ResultCollector
<
T
>
rc
:
results
)
{
resultCollectors
.
add
(
rc
);
final
long
local_ratio
=
ratio
;
long
feasibleTasksets
=
rc
.
getResults
().
stream
()
.
filter
(
r
->
Math
.
round
(
r
.
getParallelTaskRatio
()
*
10
)
==
local_ratio
)
.
filter
(
r
->
r
.
checkTasksetFeasible
()).
count
();
resultTable
.
put
(
ratio
,
rc
,
feasibleTasksets
);
}
}
logData
(
log
,
resultTable
,
resultCollectors
);
}
private
<
T
extends
TypeInterface
>
void
logData
(
Logger
log
,
Table
<
Long
,
ResultCollector
<
T
>,
Long
>
resultTable
,
Set
<
ResultCollector
<
T
>>
resultCollectors
)
{
final
Appendable
out
=
new
StringBuilder
();
try
{
String
[]
resultCollectorNames
=
resultCollectors
.
stream
()
.
map
(
ResultCollector
<
T
>::
getName
).
toArray
(
String
[]::
new
);
String
[]
header
=
ObjectArrays
.
concat
(
"Utilization"
,
resultCollectorNames
);
final
CSVPrinter
printer
=
CSVFormat
.
DEFAULT
.
withHeader
(
header
).
print
(
out
);
printer
.
printRecords
(
resultTable
.
rowMap
().
entrySet
().
stream
()
.
map
(
entry
->
ImmutableList
.
builder
().
add
((
double
)
entry
.
getKey
()
/
10
)
.
addAll
(
entry
.
getValue
().
values
()).
build
())
.
collect
(
Collectors
.
toList
()));
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
log
.
log
(
out
);
log
.
finalize
();
}
// public <T extends TypeInterface> void logFeasibility(
// Table<Long, ResultCollector<T>, Set<SchedulingInfo>> results, String type) {
// LocalTime date = LocalTime.now();
// Logger log = new Logger("./results/feasibility_" + type + "_" + numberOfProcessors + "_"
// + date.getHour() + ":" + date.getMinute() + ".txt");
// String firstLine = new String("Utilization");
// if (!results.isEmpty()) {
// for (ResultCollector<T> pair : results.columnKeySet()) {
// firstLine = firstLine + "\t" + pair.getName();
// }
// log.log(firstLine);
// for (Long util : totalNumberOfTasksets.keySet()) {
// String line = String.valueOf((double) util / 10);
// for (ResultCollector<T> pair : results.columnKeySet()) {
// long feasibleTasksets = results.get(util, pair).stream()
// .filter(s -> s.checkTasksetFeasible()).count();
// line += "\t" + feasibleTasksets;
// }
// log.log(line);
// }
// }
// log.finalize();
// }
// public <T extends TypeInterface> void logFailedTardiness(
// Table<Long, ResultCollector<T>, Set<SchedulingInfo>> results, String type) {
// LocalTime date = LocalTime.now();
// Logger log = new Logger("./results/failed_tardiness_" + type + "_" + numberOfProcessors
// + "_" + date.getHour() + ":" + date.getMinute() + ".txt");
// String firstLine = new String("Utilization");
// if (!results.isEmpty()) {
// for (ResultCollector<T> pair : results.columnKeySet()) {
// firstLine = firstLine + "\t" + pair.getName();
// }
// log.log(firstLine);
// for (Long kv : totalNumberOfTasksets.keySet()) {
// String line = String.valueOf((double) kv / 10);
// for (ResultCollector<T> pair : results.columnKeySet()) {
// Set<SchedulingInfo> simulationInfos = results.get(kv, pair);
// List<Long> values = new ArrayList<>();
// for (SchedulingInfo s : simulationInfos) {
// Optional<TerminationInfo> failedTerminationInfo =
// s.getFailedTerminationInfo();
// if (failedTerminationInfo.isPresent()) {
// values.add(failedTerminationInfo.get().getLateness());
// }
// }
// double meanTardiness = 0;
// if (!values.isEmpty()) {
// meanTardiness = Stats.meanOf(values.iterator());
// }
// line += "\t" + meanTardiness;
// }
// log.log(line);
// }
// }
// log.finalize();
// }
// public <T extends TypeInterface> void logTardinessStatistics(
// Table<Long, ResultCollector<T>, Set<SchedulingInfo>> results, String type) {
// LocalTime date = LocalTime.now();
// Logger log = new Logger("./results/statistics_tardiness_" + type + "_" + numberOfProcessors
// + "_" + date.getHour() + ":" + date.getMinute() + ".txt");
// String firstLine = new String("Utilization");
// if (!results.isEmpty()) {
// for (ResultCollector<T> pair : results.columnKeySet()) {
// firstLine = firstLine + "\t" + pair.getName();
// }
// log.log(firstLine);
// for (Long kv : totalNumberOfTasksets.keySet()) {
// String line = String.valueOf((double) kv / 10);
// for (ResultCollector<T> pair : results.columnKeySet()) {
// Set<SchedulingInfo> simulationInfos = results.get(kv, pair);
// DescriptiveStatistics stats = new DescriptiveStatistics();
// for (SchedulingInfo s : simulationInfos) {
// for (TerminationInfo t : s.getTerminationInfos()) {
// stats.addValue(t.getLateness());
// }
// }
// line += "\t" + stats.getMean();
// }
// log.log(line);
// }
// }
// log.finalize();
// }
}
src/main/java/mvd/jester/TestEnvironment.java
View file @
d255848d
package
mvd
.
jester
;
import
java.lang.reflect.Constructor
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.collect.HashBasedTable
;
import
com.google.common.collect.Table
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.priority.PriorityManager
;
...
...
@@ -78,31 +74,32 @@ public class TestEnvironment {
}
public
void
runTests
()
{
Set
<
Pair
<
AbstractTest
>>
abstractTestInstances
=
new
HashSet
<>();
Set
<
Pair
<
AbstractSimulator
>>
abstractSimulatorInstances
=
new
HashSet
<>();
Map
<
Long
,
Long
>
totalNumberOfTasksets
=
new
HashMap
<>();
Table
<
Long
,
Pair
<
AbstractTest
>,
Set
<
SchedulingInfo
>>
testResults
=
HashBasedTable
.
create
();
Table
<
Long
,
Pair
<
AbstractSimulator
>,
Set
<
SchedulingInfo
>>
simulatorResults
=
HashBasedTable
.
create
();
Set
<
ResultCollector
<
AbstractTest
>>
abstractTestInstances
=
new
HashSet
<>();
Set
<
ResultCollector
<
AbstractSimulator
>>
abstractSimulatorInstances
=
new
HashSet
<>();
for
(
PriorityManager
pm
:
schedulingAlgorithms
)
{
for
(
Constructor
<?
extends
AbstractTest
>
c
:
abstractTests
)
{
try
{
abstractTestInstances
.
add
(
new
Pair
<
AbstractTest
>(
pm
,
c
.
newInstance
(
this
.
systemSetup
)));
if
(
pm
.
hasTest
(
c
.
getDeclaringClass
()))
{
abstractTestInstances
.
add
(
new
ResultCollector
<
AbstractTest
>(
pm
,
c
.
newInstance
(
this
.
systemSetup
)));
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not instantiate object of AbstractTest!"
);
throw
new
RuntimeException
(
"Could not instantiate object of AbstractTest!"
);
}
}
for
(
Constructor
<?
extends
AbstractSimulator
>
c
:
abstractSimulators
)
{
try
{
abstractSimulatorInstances
.
add
(
new
Pair
<
AbstractSimulator
>(
pm
,
c
.
newInstance
(
this
.
systemSetup
)));
if
(
pm
.
hasSimulator
(
c
.
getDeclaringClass
()))
{
abstractSimulatorInstances
.
add
(
new
ResultCollector
<
AbstractSimulator
>(
pm
,
c
.
newInstance
(
this
.
systemSetup
)));
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not instantiate object of AbstractSimulator!"
);
throw
new
RuntimeException
(
"Could not instantiate object of AbstractSimulator!"
);
}
}
}
...
...
@@ -119,41 +116,26 @@ public class TestEnvironment {
checkedTasksets
++;
if
(
checkedTasksets
%
100
==
0
)
{
System
.
out
.
println
(
checkedTasksets
+
" bereits geschafft"
);
System
.
out
.
print
(
Math
.
round
((
double
)
checkedTasksets
/
numberOfTaskSets
*
100
)
+
"% of "
+
numberOfTaskSets
+
" tasksets tested!\r"
);
}
long
roundedUtilization
=
(
long
)
(
utilization
*
10
);
totalNumberOfTasksets
.
compute
(
roundedUtilization
,
(
k
,
v
)
->
v
==
null
?
1
:
v
+
1
);
for
(
Pair
<
AbstractTest
>
testInstance
:
abstractTestInstances
)
{
for
(
ResultCollector
<
AbstractTest
>
testInstance
:
abstractTestInstances
)
{
PriorityManager
priorityManager
=
testInstance
.
getPriorityManager
();
AbstractTest
abstractTest
=
testInstance
.
getAbstractValue
();
if
(!
testResults
.
contains
(
roundedUtilization
,
testInstance
))
{
testResults
.
put
(
roundedUtilization
,
testInstance
,
new
HashSet
<>());
}
if
(
priorityManager
.
hasTest
(
abstractTest
))
{
SchedulingInfo
schedulingInfo
=
abstractTest
.
runSchedulabilityCheck
(
priorityManager
);
testResults
.
get
(
roundedUtilization
,
testInstance
).
add
(
schedulingInfo
);
}
SchedulingInfo
schedulingInfo
=
abstractTest
.
runSchedulabilityCheck
(
priorityManager
);
testInstance
.
addResult
(
schedulingInfo
);
}
for
(
Pai
r
<
AbstractSimulator
>
simulatorInstance
:
abstractSimulatorInstances
)
{
for
(
ResultCollecto
r
<
AbstractSimulator
>
simulatorInstance
:
abstractSimulatorInstances
)
{
PriorityManager
priorityManager
=
simulatorInstance
.
getPriorityManager
();
AbstractSimulator
abstractSimulator
=
simulatorInstance
.
getAbstractValue
();
if
(!
simulatorResults
.
contains
(
roundedUtilization
,
simulatorInstance
))
{
simulatorResults
.
put
(
roundedUtilization
,
simulatorInstance
,
new
HashSet
<>());
}
if
(
priorityManager
.
hasSimulator
(
abstractSimulator
))
{
SchedulingInfo
schedulingInfo
=
abstractSimulator
.
runSimulation
(
priorityManager
);
simulatorResults
.
get
(
roundedUtilization
,
simulatorInstance
)
.
add
(
schedulingInfo
);
}
SchedulingInfo
schedulingInfo
=
abstractSimulator
.
runSimulation
(
priorityManager
);
simulatorInstance
.
addResult
(
schedulingInfo
);
}
builder
.
addTask
(
systemSetup
);
...
...
@@ -161,11 +143,10 @@ public class TestEnvironment {
utilization
=
this
.
systemSetup
.
getUtilization
();
}
}
System
.
out
.
println
(
""
);
ResultLogger
resultLogger
=
new
ResultLogger
(
systemSetup
.
getNumberOfProcessors
());
ResultCollector
resultCollector
=
new
ResultCollector
(
testResults
,
simulatorResults
,
totalNumberOfTasksets
,
systemSetup
.
getNumberOfProcessors
());
resultCollector
.
logAll
();
resultLogger
.
logTests
(
abstractTestInstances
);
}
}
...
...
src/main/java/mvd/jester/
Pair
Interface.java
→
src/main/java/mvd/jester/
Type
Interface.java
View file @
d255848d
...
...
@@ -3,9 +3,7 @@ package mvd.jester;
/**
* PairInterface
*/
public
interface
Pair
Interface
{
public
interface
Type
Interface
{
public
String
getName
();
}
src/main/java/mvd/jester/info/SchedulingInfo.java
View file @
d255848d
...
...
@@ -9,16 +9,37 @@ import java.util.Set;
*/
public
class
SchedulingInfo
{
private
final
double
parallelTaskRatio
;
private
final
double
utilization
;
private
final
Set
<
TerminationInfo
>
terminationInfos
;
private
Optional
<
TerminationInfo
>
failedTerminationInfo
;
public
SchedulingInfo
()
{
public
SchedulingInfo
(
double
parallelTaskRatio
,
double
utilization
)
{
this
.
parallelTaskRatio
=
parallelTaskRatio
;
this
.
utilization
=
utilization
;
this
.
terminationInfos
=
new
HashSet
<>();
this
.
failedTerminationInfo
=
Optional
.
empty
();
}
public
SchedulingInfo
(
Set
<
TerminationInfo
>
terminationInfos
)
{
/**
* @return the utilization
*/
public
double
getUtilization
()
{
return
utilization
;
}
/**
* @return the parallelTaskRatio
*/
public
double
getParallelTaskRatio
()
{
return
parallelTaskRatio
;
}
public
SchedulingInfo
(
Set
<
TerminationInfo
>
terminationInfos
,
double
parallelTaskRatio
,
double
utilization
)
{
this
.
terminationInfos
=
terminationInfos
;
this
.
parallelTaskRatio
=
parallelTaskRatio
;
this
.
utilization
=
utilization
;
failedTerminationInfo
=
terminationInfos
.
stream
().
filter
(
t
->
t
.
getLateness
()
>
0
).
findFirst
();
}
...
...
@@ -46,7 +67,7 @@ public class SchedulingInfo {
return
failedTerminationInfo
;
}
public
void
setFailedTe
mr
inationInfo
(
TerminationInfo
failedTerminationInfo
)
{
public
void
setFailedTe
rm
inationInfo
(
TerminationInfo
failedTerminationInfo
)
{
this
.
failedTerminationInfo
=
Optional
.
of
(
failedTerminationInfo
);
}
}
src/main/java/mvd/jester/model/SystemSetup.java
View file @
d255848d
...
...
@@ -51,6 +51,19 @@ public class SystemSetup {
return
utilization
;
}
public
double
getParallelTaskRatio
()
{
long
parallelTasks
=
0
;
for
(
Task
t
:
tasks
)
{
if
(
t
.
getMaximumParallelism
()
>
1
)
{