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
0232b488
authored
Jul 11, 2019
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
terminated refactoring, looks good now
parent
59c46e2a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
47 deletions
+55
-47
src/main/java/mvd/jester/App.java
+2
-2
src/main/java/mvd/jester/model/SystemSetup.java
+17
-14
src/main/java/mvd/jester/tests/MaiaBertogna.java
+4
-4
src/main/java/mvd/jester/tests/SchmidMottok.java
+9
-7
src/main/java/mvd/jester/tests/TestEnvironment.java
+21
-16
src/main/java/mvd/jester/tests/TestInterface.java
+1
-3
src/test/java/mvd/jester/model/TaskSetTest.java
+1
-1
No files found.
src/main/java/mvd/jester/App.java
View file @
0232b488
package
mvd
.
jester
;
import
mvd.jester.model.Task
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.tests.MaiaBertogna
;
import
mvd.jester.tests.SchmidMottok
;
...
...
@@ -12,8 +11,9 @@ import mvd.jester.tests.TestEnvironment;
*/
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
SystemSetup
.
Builder
generator
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
4
);
TestEnvironment
te
=
new
TestEnvironment
(
4000
,
4
);
TestEnvironment
te
=
new
TestEnvironment
(
generator
,
10000
);
te
.
registerTestInterface
(
SchmidMottok
.
class
);
te
.
registerTestInterface
(
MaiaBertogna
.
class
);
...
...
src/main/java/mvd/jester/model/SystemSetup.java
View file @
0232b488
...
...
@@ -25,7 +25,7 @@ public class SystemSetup {
return
tasks
;
}
public
void
set
SortedTaskSet
(
SortedTaskSet
tasks
)
{
public
void
set
Tasks
(
SortedTaskSet
tasks
)
{
this
.
tasks
=
tasks
;
}
...
...
@@ -45,7 +45,7 @@ public class SystemSetup {
return
utilization
;
}
public
static
class
Generato
r
{
public
static
class
Builde
r
{
private
long
numberOfProcessors
=
4
;
private
long
minPeriod
=
100
;
private
long
maxPeriod
=
1000
;
...
...
@@ -57,7 +57,7 @@ public class SystemSetup {
private
long
ratio
=
randomTaskRatio
();
private
PriorityManager
priorityManager
=
new
RateMonotonic
();
public
Generato
r
()
{
public
Builde
r
()
{
}
...
...
@@ -119,33 +119,36 @@ public class SystemSetup {
return
new
SystemSetup
(
taskSet
,
numberOfProcessors
);
}
public
void
addTask
(
SystemSetup
taskSet
)
{
taskSet
.
tasks
.
add
(
generateTask
());
public
void
rebuild
(
SystemSetup
systemSetup
)
{
this
.
ratio
=
randomTaskRatio
();
systemSetup
.
tasks
=
generateTaskSet
();
}
/**
* @param numberOfProcessors the numberOfProcessors to set
*/
public
void
setNumberOfProcessors
(
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
public
void
addTask
(
SystemSetup
systemSetup
)
{
systemSetup
.
tasks
.
add
(
generateTask
());
}
public
Builder
setNumberOfProcessors
(
long
numberOfProcessors
)
{
this
.
numberOfProcessors
=
numberOfProcessors
;
return
this
;
}
public
Generato
r
setNumberOfSegments
(
long
minNumberOfSegments
,
long
maxNumberOfSegments
)
{
public
Builde
r
setNumberOfSegments
(
long
minNumberOfSegments
,
long
maxNumberOfSegments
)
{
this
.
minNumberOfSegments
=
minNumberOfSegments
;
this
.
maxNumberOfSegments
=
maxNumberOfSegments
;
return
this
;
}
public
Generato
r
setPeriods
(
long
minPeriod
,
long
maxPeriod
)
{
public
Builde
r
setPeriods
(
long
minPeriod
,
long
maxPeriod
)
{
this
.
minPeriod
=
minPeriod
;
this
.
maxPeriod
=
maxPeriod
;
return
this
;
}
public
Generato
r
setPriorityManager
(
PriorityManager
priorityManager
)
{
public
Builde
r
setPriorityManager
(
PriorityManager
priorityManager
)
{
this
.
priorityManager
=
priorityManager
;
return
this
;
}
...
...
@@ -153,7 +156,7 @@ public class SystemSetup {
/**
* @param maxNumberOfJobs the maxNumberOfJobs to set
*/
public
Generato
r
setNumberOfJobs
(
long
minNumberOfJobs
,
long
maxNumberOfJobs
)
{
public
Builde
r
setNumberOfJobs
(
long
minNumberOfJobs
,
long
maxNumberOfJobs
)
{
this
.
minNumberOfJobs
=
minNumberOfJobs
;
this
.
maxNumberOfJobs
=
maxNumberOfJobs
;
return
this
;
...
...
src/main/java/mvd/jester/tests/MaiaBertogna.java
View file @
0232b488
...
...
@@ -12,15 +12,15 @@ import mvd.jester.model.SystemSetup;
*/
public
class
MaiaBertogna
extends
AbstractTest
{
private
SystemSetup
systemSetup
;
private
final
SystemSetup
systemSetup
;
public
MaiaBertogna
()
{
public
MaiaBertogna
(
SystemSetup
systemSetup
)
{
this
.
systemSetup
=
systemSetup
;
}
@Override
public
boolean
runSchedulabilityCheck
(
SystemSetup
systemSetup
)
{
public
boolean
runSchedulabilityCheck
()
{
responseTimes
.
clear
();
this
.
systemSetup
=
systemSetup
;
for
(
Task
t
:
systemSetup
.
getTasks
())
{
responseTimes
.
put
(
t
,
calculateResponseTime
(
t
));
}
...
...
src/main/java/mvd/jester/tests/SchmidMottok.java
View file @
0232b488
...
...
@@ -12,15 +12,15 @@ import mvd.jester.model.SystemSetup;
*/
public
class
SchmidMottok
extends
AbstractTest
{
private
SystemSetup
systemSetup
;
private
final
SystemSetup
systemSetup
;
public
SchmidMottok
()
{
public
SchmidMottok
(
SystemSetup
systemSetup
)
{
this
.
systemSetup
=
systemSetup
;
}
@Override
public
boolean
runSchedulabilityCheck
(
SystemSetup
systemSetup
)
{
public
boolean
runSchedulabilityCheck
()
{
responseTimes
.
clear
();
this
.
systemSetup
=
systemSetup
;
for
(
Task
t
:
systemSetup
.
getTasks
())
{
responseTimes
.
put
(
t
,
calculateResponseTime
(
t
));
}
...
...
@@ -56,7 +56,7 @@ public class SchmidMottok extends AbstractTest {
}
}
double
taskInterference
=
(
double
)
interference
/
4
;
double
taskInterference
=
(
double
)
interference
/
systemSetup
.
getNumberOfProcessors
()
;
double
selfInterference
=
getSelfInterference
(
task
);
long
totalInterference
=
(
long
)
Math
.
floor
(
taskInterference
+
selfInterference
);
...
...
@@ -71,11 +71,13 @@ public class SchmidMottok extends AbstractTest {
private
double
getSelfInterference
(
Task
task
)
{
double
interference
=
0
;
long
numberOfProcessors
=
systemSetup
.
getNumberOfProcessors
();
for
(
Segment
s
:
task
.
getSegments
())
{
long
processingUnits
=
s
.
getNumberOfJobs
()
>
4
?
4
:
s
.
getNumberOfJobs
();
long
numberOfJobs
=
s
.
getNumberOfJobs
()
>
numberOfProcessors
?
numberOfProcessors
:
s
.
getNumberOfJobs
();
interference
+=
(
double
)
(
s
.
getNumberOfTasklets
()
-
1
)
*
s
.
getTaskletWcet
()
/
processingUnit
s
;
(
double
)
(
s
.
getNumberOfTasklets
()
-
1
)
*
s
.
getTaskletWcet
()
/
numberOfJob
s
;
}
return
interference
;
...
...
src/main/java/mvd/jester/tests/TestEnvironment.java
View file @
0232b488
...
...
@@ -5,7 +5,6 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
mvd.jester.model.SortedTaskSet
;
import
mvd.jester.model.SystemSetup
;
/**
...
...
@@ -14,17 +13,24 @@ import mvd.jester.model.SystemSetup;
public
class
TestEnvironment
{
private
final
long
numberOfTaskSets
;
private
final
long
numberOfProcessors
;
private
final
Set
<
Class
<?
extends
AbstractTest
>>
abstractTests
;
private
final
SystemSetup
systemSetup
;
private
final
SystemSetup
.
Builder
builder
;
private
final
Set
<
Constructor
<?
extends
AbstractTest
>>
abstractTests
;
public
TestEnvironment
(
long
numberOfTaskSets
,
long
numberOfProcessor
s
)
{
public
TestEnvironment
(
SystemSetup
.
Builder
builder
,
long
numberOfTaskSet
s
)
{
this
.
numberOfTaskSets
=
numberOfTaskSets
;
this
.
numberOfProcessors
=
numberOfProcessors
;
abstractTests
=
new
HashSet
<>();
this
.
builder
=
builder
;
this
.
systemSetup
=
builder
.
build
();
}
public
TestEnvironment
registerTestInterface
(
Class
<?
extends
AbstractTest
>
abstractTest
)
{
abstractTests
.
add
(
abstractTest
);
try
{
abstractTests
.
add
(
abstractTest
.
getConstructor
(
SystemSetup
.
class
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Missing constructor!"
);
}
return
this
;
}
...
...
@@ -32,9 +38,9 @@ public class TestEnvironment {
public
void
runTests
()
{
Map
<
AbstractTest
,
Long
>
testCases
=
new
HashMap
<>();
for
(
C
lass
<?
extends
AbstractTest
>
t
:
abstractTests
)
{
for
(
C
onstructor
<?
extends
AbstractTest
>
t
:
abstractTests
)
{
try
{
testCases
.
put
(
t
.
newInstance
(),
(
long
)
0
);
testCases
.
put
(
t
.
newInstance
(
this
.
systemSetup
),
(
long
)
0
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Ahhh SHIT!"
);
}
...
...
@@ -43,24 +49,23 @@ public class TestEnvironment {
long
checkedTasksets
=
0
;
while
(
checkedTasksets
<
4000
)
{
SystemSetup
.
Generator
generator
=
new
SystemSetup
.
Generator
();
SystemSetup
systemSetup
=
generator
.
build
();
while
(
checkedTasksets
<
numberOfTaskSets
)
{
builder
.
rebuild
(
this
.
systemSetup
);
double
utilization
=
systemSetup
.
getUtilization
();
double
utilization
=
this
.
systemSetup
.
getUtilization
();
while
(
utilization
<=
systemSetup
.
getNumberOfProcessors
()
while
(
utilization
<=
this
.
systemSetup
.
getNumberOfProcessors
()
&&
checkedTasksets
<
numberOfTaskSets
)
{
checkedTasksets
++;
for
(
AbstractTest
t
:
testCases
.
keySet
())
{
if
(
t
.
runSchedulabilityCheck
(
systemSetup
))
{
if
(
t
.
runSchedulabilityCheck
())
{
testCases
.
computeIfPresent
(
t
,
(
k
,
v
)
->
v
+
1
);
}
}
generato
r
.
addTask
(
systemSetup
);
builde
r
.
addTask
(
systemSetup
);
utilization
=
systemSetup
.
getUtilization
();
utilization
=
this
.
systemSetup
.
getUtilization
();
}
}
...
...
src/main/java/mvd/jester/tests/TestInterface.java
View file @
0232b488
package
mvd
.
jester
.
tests
;
import
mvd.jester.model.SystemSetup
;
/**
* TestInterface
*/
public
interface
TestInterface
{
public
boolean
runSchedulabilityCheck
(
SystemSetup
systemSetup
);
public
boolean
runSchedulabilityCheck
();
public
String
getName
();
...
...
src/test/java/mvd/jester/model/TaskSetTest.java
View file @
0232b488
...
...
@@ -14,7 +14,7 @@ public class TaskSetTest {
public
void
testRandomTaskSetGeneration
()
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_SETS
;
++
i
)
{
SystemSetup
taskSet
=
new
SystemSetup
.
Generato
r
().
build
();
SystemSetup
taskSet
=
new
SystemSetup
.
Builde
r
().
build
();
for
(
Task
t
:
taskSet
.
getTasks
())
{
assertTrue
(
t
.
getPeriod
()
>=
100
);
...
...
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