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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
40 deletions
+72
-40
.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
+11
-16
No files found.
.classpath
View file @
402173ef
...
...
@@ -31,6 +31,12 @@
<attribute
name=
"m2e-apt"
value=
"true"
/>
</attributes>
</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"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
...
...
pom.xml
View file @
402173ef
...
...
@@ -16,6 +16,11 @@
<dependencies>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-math3
</artifactId>
<version>
3.2
</version>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-api
</artifactId>
<version>
5.4.0
</version>
...
...
src/main/java/mvd/jester/App.java
View file @
402173ef
...
...
@@ -12,16 +12,16 @@ import mvd.jester.priority.RateMonotonic;
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
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
EarliestDeadlineFirst
());
//
te.registerSchedulingAlgorithm(new EarliestDeadlineFirst());
//
te.registerTest(mvd.jester.tests.SchmidMottok.class);
//
te.registerTest(mvd.jester.tests.MaiaBertogna.class);
te
.
registerTest
(
mvd
.
jester
.
tests
.
SchmidMottok
.
class
);
te
.
registerTest
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
);
te
.
registerSimulator
(
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
);
te
.
registerSimulator
(
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
);
//
te.registerSimulator(mvd.jester.simulator.MaiaBertogna.class);
//
te.registerSimulator(mvd.jester.simulator.SchmidMottok.class);
te
.
runTests
();
...
...
src/main/java/mvd/jester/ResultCollector.java
View file @
402173ef
...
...
@@ -8,6 +8,7 @@ import java.util.Optional;
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
;
...
...
@@ -36,22 +37,52 @@ public class ResultCollector {
public
void
logAll
()
{
if
(!
testResults
.
isEmpty
())
{
logFeasibility
(
testResults
,
"test"
);
logTardinessStatistics
(
simulatorResults
,
"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
<
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
(
Table
<
Long
,
Pair
<
T
>,
Set
<
SchedulingInfo
>>
results
,
String
type
)
{
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"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
...
@@ -61,8 +92,7 @@ public class ResultCollector {
log
.
log
(
firstLine
);
for
(
Long
util
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
util
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
util
);
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
();
...
...
@@ -81,7 +111,7 @@ public class ResultCollector {
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/failed_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
...
@@ -91,8 +121,7 @@ public class ResultCollector {
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
kv
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
kv
);
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
<>();
...
...
@@ -122,7 +151,7 @@ public class ResultCollector {
LocalTime
date
=
LocalTime
.
now
();
Logger
log
=
new
Logger
(
"./results/statistics_tardiness_"
+
type
+
"_"
+
numberOfProcessors
+
"_"
+
date
.
getHour
()
+
":"
+
date
.
getMinute
()
+
".txt"
);
String
firstLine
=
new
String
(
"Utilization
\tTotal
"
);
String
firstLine
=
new
String
(
"Utilization"
);
if
(!
results
.
isEmpty
())
{
for
(
Pair
<
T
>
pair
:
results
.
columnKeySet
())
{
...
...
@@ -132,23 +161,18 @@ public class ResultCollector {
log
.
log
(
firstLine
);
for
(
Long
kv
:
totalNumberOfTasksets
.
keySet
())
{
String
line
=
String
.
valueOf
((
double
)
kv
/
10
)
+
"\t"
+
totalNumberOfTasksets
.
get
(
kv
);
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
<>
();
DescriptiveStatistics
stats
=
new
DescriptiveStatistics
();
for
(
SchedulingInfo
s
:
simulationInfos
)
{
for
(
TerminationInfo
t
:
s
.
getTerminationInfos
())
{
values
.
add
(
t
.
getLateness
());
stats
.
addValue
(
t
.
getLateness
());
}
}
double
meanTardiness
=
0
;
if
(!
values
.
isEmpty
())
{
meanTardiness
=
Stats
.
meanOf
(
values
.
iterator
());
}
line
+=
"\t"
+
meanTardiness
;
line
+=
"\t"
+
stats
.
getMean
();
}
log
.
log
(
line
);
}
...
...
src/main/java/mvd/jester/info/SchedulingInfo.java
View file @
402173ef
...
...
@@ -19,6 +19,8 @@ public class SchedulingInfo {
public
SchedulingInfo
(
Set
<
TerminationInfo
>
terminationInfos
)
{
this
.
terminationInfos
=
terminationInfos
;
failedTerminationInfo
=
terminationInfos
.
stream
().
filter
(
t
->
t
.
getLateness
()
>
0
).
findFirst
();
}
public
boolean
checkTasksetFeasible
()
{
...
...
src/main/java/mvd/jester/model/SystemSetup.java
View file @
402173ef
...
...
@@ -101,8 +101,11 @@ public class SystemSetup {
}
private
long
randomTaskPeriod
()
{
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
);
private
long
randomTaskPeriod
(
boolean
serial
)
{
if
(
serial
)
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
);
else
return
ThreadLocalRandom
.
current
().
nextLong
(
minPeriod
,
maxPeriod
*
10
);
}
private
long
randomTaskRatio
()
{
...
...
@@ -126,20 +129,13 @@ public class SystemSetup {
private
Task
generateTask
()
{
boolean
serial
=
randomTaskRatio
()
>
this
.
ratio
;
long
period
=
randomTaskPeriod
();
long
numberOfSegments
=
1
;
Set
<
Segment
>
segments
=
new
LinkedHashSet
<
Segment
>();
if
(!
serial
)
{
numberOfSegments
=
randomNumberOfSegments
();
}
else
{
numberOfSegments
=
1
;
}
long
period
=
randomTaskPeriod
(
serial
);
long
numberOfSegments
=
serial
?
1
:
randomNumberOfSegments
();
long
parallelNumberOfJobs
=
serial
?
1
:
randomNumberOfJobs
();
Set
<
Segment
>
segments
=
new
LinkedHashSet
<
Segment
>();
for
(
int
i
=
0
;
i
<
numberOfSegments
;
++
i
)
{
long
numberOfJobs
=
1
;
if
(
i
%
2
==
1
)
{
numberOfJobs
=
parallelNumberOfJobs
;
}
long
numberOfJobs
=
i
%
2
==
1
?
parallelNumberOfJobs
:
1
;
long
wcet
=
randomWcet
(
period
,
numberOfSegments
);
segments
.
add
(
new
Segment
(
wcet
,
numberOfJobs
));
}
...
...
@@ -147,10 +143,9 @@ public class SystemSetup {
}
private
Set
<
Task
>
generateTaskSet
()
{
// SortedTaskSet taskSet = new SortedTaskSet(priorityManager);
Set
<
Task
>
taskSet
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberOfProcessors
;
++
i
)
{
Task
task
=
generateTask
();
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