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
402173ef
authored
Jan 13, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated ResultCollector and minor changes
parent
2a366392
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
39 deletions
+71
-39
.classpath
+6
-0
pom.xml
+5
-0
src/main/java/mvd/jester/App.java
+6
-6
src/main/java/mvd/jester/ResultCollector.java
+42
-18
src/main/java/mvd/jester/info/SchedulingInfo.java
+2
-0
src/main/java/mvd/jester/model/SystemSetup.java
+10
-15
No files found.
.classpath
View file @
402173ef
...
@@ -31,6 +31,12 @@
...
@@ -31,6 +31,12 @@
<attribute
name=
"m2e-apt"
value=
"true"
/>
<attribute
name=
"m2e-apt"
value=
"true"
/>
</attributes>
</attributes>
</classpathentry>
</classpathentry>
<classpathentry
excluding=
"**"
kind=
"src"
output=
"target/test-classes"
path=
"src/test/resources"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
<attribute
name=
"test"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"src"
output=
"target/test-classes"
path=
"target/generated-test-sources/test-annotations"
>
<classpathentry
kind=
"src"
output=
"target/test-classes"
path=
"target/generated-test-sources/test-annotations"
>
<attributes>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
<attribute
name=
"optional"
value=
"true"
/>
...
...
pom.xml
View file @
402173ef
...
@@ -16,6 +16,11 @@
...
@@ -16,6 +16,11 @@
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-math3
</artifactId>
<version>
3.2
</version>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-api
</artifactId>
<artifactId>
junit-jupiter-api
</artifactId>
<version>
5.4.0
</version>
<version>
5.4.0
</version>
...
...
src/main/java/mvd/jester/App.java
View file @
402173ef
...
@@ -12,16 +12,16 @@ import mvd.jester.priority.RateMonotonic;
...
@@ -12,16 +12,16 @@ 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
);
SystemSetup
.
Builder
builder
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
8
);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
3
0000
);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
4
0000
);
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
.
registerSimulator
(
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
);
//
te.registerSimulator(mvd.jester.simulator.MaiaBertogna.class);
te
.
registerSimulator
(
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
);
//
te.registerSimulator(mvd.jester.simulator.SchmidMottok.class);
te
.
runTests
();
te
.
runTests
();
...
...
src/main/java/mvd/jester/ResultCollector.java
View file @
402173ef
...
@@ -8,6 +8,7 @@ import java.util.Optional;
...
@@ -8,6 +8,7 @@ import java.util.Optional;
import
java.util.Set
;
import
java.util.Set
;
import
com.google.common.collect.Table
;
import
com.google.common.collect.Table
;
import
com.google.common.math.Stats
;
import
com.google.common.math.Stats
;
import
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.SchedulingInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.info.TerminationInfo
;
import
mvd.jester.simulator.AbstractSimulator
;
import
mvd.jester.simulator.AbstractSimulator
;
...
@@ -36,22 +37,52 @@ public class ResultCollector {
...
@@ -36,22 +37,52 @@ public class ResultCollector {
public
void
logAll
()
{
public
void
logAll
()
{
if
(!
testResults
.
isEmpty
())
{
if
(!
testResults
.
isEmpty
())
{
logFeasibility
(
testResults
,
"test"
);
logFeasibility
(
testResults
,
"test"
);
logTardinessStatistics
(
simulatorResults
,
"test"
);
logFeasibilityRatio
(
testResults
,
"test"
);
logTardinessStatistics
(
testResults
,
"test"
);
logFailedTardiness
(
testResults
,
"test"
);
logFailedTardiness
(
testResults
,
"test"
);
}
}
if
(!
simulatorResults
.
isEmpty
())
{
if
(!
simulatorResults
.
isEmpty
())
{
logFeasibility
(
simulatorResults
,
"sim"
);
logFeasibility
(
simulatorResults
,
"sim"
);
logFeasibilityRatio
(
simulatorResults
,
"sim"
);
logTardinessStatistics
(
simulatorResults
,
"sim"
);
logTardinessStatistics
(
simulatorResults
,
"sim"
);
logFailedTardiness
(
simulatorResults
,
"sim"
);
logFailedTardiness
(
simulatorResults
,
"sim"
);
}
}
}
}
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
();
}
public
<
T
extends
PairInterface
>
void
logFeasibility
(
public
<
T
extends
PairInterface
>
void
logFeasibility
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
LocalTime
date
=
LocalTime
.
now
();
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/
results
_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
Logger
log
=
new
Logger
(
"./results/
feasibility
_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
@@ -61,8 +92,7 @@ public class ResultCollector {
...
@@ -61,8 +92,7 @@ public class ResultCollector {
log
.
log
(
firstLine
);
log
.
log
(
firstLine
);
for
(
Long
util
:
totalNumberOfTasksets
.
keySet
())
{
for
(
Long
util
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
line
=
String
.
valueOf
((
double
)
util
/
10
);
String
.
valueOf
((
double
)
util
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
util
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
long
feasibleTasksets
=
results
.
get
(
util
,
pair
).
stream
()
long
feasibleTasksets
=
results
.
get
(
util
,
pair
).
stream
()
.
filter
(
s
->
s
.
checkTasksetFeasible
()).
count
();
.
filter
(
s
->
s
.
checkTasksetFeasible
()).
count
();
...
@@ -81,7 +111,7 @@ public class ResultCollector {
...
@@ -81,7 +111,7 @@ public class ResultCollector {
LocalTime
date
=
LocalTime
.
now
();
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/failed_tardiness_"
+
type
+
"_"
+
numberOfProcessors
Logger
log
=
new
Logger
(
"./results/failed_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
@@ -91,8 +121,7 @@ public class ResultCollector {
...
@@ -91,8 +121,7 @@ public class ResultCollector {
log
.
log
(
firstLine
);
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
line
=
String
.
valueOf
((
double
)
kv
/
10
);
String
.
valueOf
((
double
)
kv
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
kv
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
List
<
Long
>
values
=
new
ArrayList
<>();
List
<
Long
>
values
=
new
ArrayList
<>();
...
@@ -122,7 +151,7 @@ public class ResultCollector {
...
@@ -122,7 +151,7 @@ public class ResultCollector {
LocalTime
date
=
LocalTime
.
now
();
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/statistics_tardiness_"
+
type
+
"_"
+
numberOfProcessors
Logger
log
=
new
Logger
(
"./results/statistics_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
@@ -132,23 +161,18 @@ public class ResultCollector {
...
@@ -132,23 +161,18 @@ public class ResultCollector {
log
.
log
(
firstLine
);
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
line
=
String
.
valueOf
((
double
)
kv
/
10
);
String
.
valueOf
((
double
)
kv
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
kv
);
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
Set
<
SchedulingInfo
>
simulationInfos
=
results
.
get
(
kv
,
pair
);
List
<
Long
>
values
=
new
ArrayList
<>
();
DescriptiveStatistics
stats
=
new
DescriptiveStatistics
();
for
(
SchedulingInfo
s
:
simulationInfos
)
{
for
(
SchedulingInfo
s
:
simulationInfos
)
{
for
(
TerminationInfo
t
:
s
.
getTerminationInfos
())
{
for
(
TerminationInfo
t
:
s
.
getTerminationInfos
())
{
values
.
add
(
t
.
getLateness
());
stats
.
addValue
(
t
.
getLateness
());
}
}
}
}
double
meanTardiness
=
0
;
line
+=
"\t"
+
stats
.
getMean
();
if
(!
values
.
isEmpty
())
{
meanTardiness
=
Stats
.
meanOf
(
values
.
iterator
());
}
line
+=
"\t"
+
meanTardiness
;
}
}
log
.
log
(
line
);
log
.
log
(
line
);
}
}
...
...
src/main/java/mvd/jester/info/SchedulingInfo.java
View file @
402173ef
...
@@ -19,6 +19,8 @@ public class SchedulingInfo {
...
@@ -19,6 +19,8 @@ public class SchedulingInfo {
public
SchedulingInfo
(
Set
<
TerminationInfo
>
terminationInfos
)
{
public
SchedulingInfo
(
Set
<
TerminationInfo
>
terminationInfos
)
{
this
.
terminationInfos
=
terminationInfos
;
this
.
terminationInfos
=
terminationInfos
;
failedTerminationInfo
=
terminationInfos
.
stream
().
filter
(
t
->
t
.
getLateness
()
>
0
).
findFirst
();
}
}
public
boolean
checkTasksetFeasible
()
{
public
boolean
checkTasksetFeasible
()
{
...
...
src/main/java/mvd/jester/model/SystemSetup.java
View file @
402173ef
...
@@ -101,8 +101,11 @@ public class SystemSetup {
...
@@ -101,8 +101,11 @@ public class SystemSetup {
}
}
private
long
randomTaskPeriod
()
{
private
long
randomTaskPeriod
(
boolean
serial
)
{
if
(
serial
)
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
);
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
);
else
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
*
10
);
}
}
private
long
randomTaskRatio
()
{
private
long
randomTaskRatio
()
{
...
@@ -126,20 +129,13 @@ public class SystemSetup {
...
@@ -126,20 +129,13 @@ public class SystemSetup {
private
Task
generateTask
()
{
private
Task
generateTask
()
{
boolean
serial
=
randomTaskRatio
()
>
this
.
ratio
;
boolean
serial
=
randomTaskRatio
()
>
this
.
ratio
;
long
period
=
randomTaskPeriod
();
long
period
=
randomTaskPeriod
(
serial
);
long
numberOfSegments
=
1
;
long
numberOfSegments
=
serial
?
1
:
randomNumberOfSegments
();
Set
<
Segment
>
segments
=
new
LinkedHashSet
<
Segment
>();
if
(!
serial
)
{
numberOfSegments
=
randomNumberOfSegments
();
}
else
{
numberOfSegments
=
1
;
}
long
parallelNumberOfJobs
=
serial
?
1
:
randomNumberOfJobs
();
long
parallelNumberOfJobs
=
serial
?
1
:
randomNumberOfJobs
();
Set
<
Segment
>
segments
=
new
LinkedHashSet
<
Segment
>();
for
(
int
i
=
0
;
i
<
numberOfSegments
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberOfSegments
;
++
i
)
{
long
numberOfJobs
=
1
;
long
numberOfJobs
=
i
%
2
==
1
?
parallelNumberOfJobs
:
1
;
if
(
i
%
2
==
1
)
{
numberOfJobs
=
parallelNumberOfJobs
;
}
long
wcet
=
randomWcet
(
period
,
numberOfSegments
);
long
wcet
=
randomWcet
(
period
,
numberOfSegments
);
segments
.
add
(
new
Segment
(
wcet
,
numberOfJobs
));
segments
.
add
(
new
Segment
(
wcet
,
numberOfJobs
));
}
}
...
@@ -147,10 +143,9 @@ public class SystemSetup {
...
@@ -147,10 +143,9 @@ public class SystemSetup {
}
}
private
Set
<
Task
>
generateTaskSet
()
{
private
Set
<
Task
>
generateTaskSet
()
{
// SortedTaskSet taskSet = new SortedTaskSet(priorityManager);
Set
<
Task
>
taskSet
=
new
HashSet
<>();
Set
<
Task
>
taskSet
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberOfProcessors
;
++
i
)
{
Task
task
=
generateTask
();
Task
task
=
generateTask
();
taskSet
.
add
(
task
);
taskSet
.
add
(
task
);
}
}
...
...
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