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
7999313d
authored
Aug 27, 2019
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intermediate commit, SchmidMottok bug still here
parent
ef2d8bd0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
70 additions
and
32 deletions
+70
-32
src/main/java/mvd/jester/App.java
+35
-7
src/main/java/mvd/jester/simulator/AbstractSimulator.java
+2
-2
src/main/java/mvd/jester/simulator/internals/ProcessorContext.java
+2
-2
src/main/java/mvd/jester/simulator/internals/TaskContextInterface.java
+1
-1
src/main/java/mvd/jester/simulator/internals/maiabertogna/JobContext.java
+4
-4
src/main/java/mvd/jester/simulator/internals/maiabertogna/TaskContext.java
+2
-2
src/main/java/mvd/jester/simulator/internals/schmidmottok/JobContext.java
+10
-7
src/main/java/mvd/jester/simulator/internals/schmidmottok/SegmentContext.java
+10
-3
src/main/java/mvd/jester/simulator/internals/schmidmottok/TaskContext.java
+2
-2
src/main/java/mvd/jester/simulator/internals/schmidmottok/TaskletContext.java
+2
-2
No files found.
src/main/java/mvd/jester/App.java
View file @
7999313d
package
mvd
.
jester
;
package
mvd
.
jester
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.model.SystemSetup
;
import
mvd.jester.simulator.MaiaBertogna
;
import
mvd.jester.simulator.SchmidMottok
;
/**
/**
* Hello world!
* Hello world!
...
@@ -8,17 +10,43 @@ import mvd.jester.model.SystemSetup;
...
@@ -8,17 +10,43 @@ import mvd.jester.model.SystemSetup;
*/
*/
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, 400);
TestEnvironment
te
=
new
TestEnvironment
(
builder
,
40000
);
// te.registerTestPair(mvd.jester.tests.MaiaBertogna.class,
// mvd.jester.simulator.MaiaBertogna.class);
te
.
registerTestPair
(
mvd
.
jester
.
tests
.
MaiaBertogna
.
class
,
// te.registerTestPair(mvd.jester.tests.SchmidMottok
.class,
mvd
.
jester
.
simulator
.
MaiaBertogna
.
class
);
// mvd.jester.simulator.SchmidMottok
.class);
te
.
registerTestPair
(
mvd
.
jester
.
tests
.
SchmidMottok
.
class
,
// te.runTests();
mvd
.
jester
.
simulator
.
SchmidMottok
.
class
);
te
.
runTests
();
boolean
mbWorked
=
false
;
boolean
smWorked
=
false
;
SystemSetup
thisOne
=
null
;
do
{
SystemSetup
.
Builder
builder
=
new
SystemSetup
.
Builder
().
setNumberOfProcessors
(
8
);
SystemSetup
systemSetup
=
builder
.
build
();
SchmidMottok
sm
=
new
SchmidMottok
(
systemSetup
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
systemSetup
);
smWorked
=
sm
.
runSimulation
();
mbWorked
=
mb
.
runSimulation
();
thisOne
=
systemSetup
;
}
while
(
smWorked
==
mbWorked
);
SchmidMottok
sm
=
new
SchmidMottok
(
thisOne
);
MaiaBertogna
mb
=
new
MaiaBertogna
(
thisOne
);
mb
.
runSimulation
();
sm
.
runSimulation
();
}
}
}
}
src/main/java/mvd/jester/simulator/AbstractSimulator.java
View file @
7999313d
...
@@ -28,7 +28,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
...
@@ -28,7 +28,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
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
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
10
;
this
.
hyperPeriod
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
2
/* * 10 */
;
}
}
...
@@ -76,7 +76,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
...
@@ -76,7 +76,7 @@ public abstract class AbstractSimulator implements SimulatorInterface {
for
(
ProcessorContext
p
:
processors
)
{
for
(
ProcessorContext
p
:
processors
)
{
p
.
setJob
(
null
);
p
.
setJob
(
null
);
}
}
this
.
hyperPeriod
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
10
;
this
.
hyperPeriod
=
systemSetup
.
getTasks
().
last
().
getPeriod
()
*
2
;
}
}
...
...
src/main/java/mvd/jester/simulator/internals/ProcessorContext.java
View file @
7999313d
...
@@ -46,8 +46,8 @@ public class ProcessorContext {
...
@@ -46,8 +46,8 @@ public class ProcessorContext {
}
}
currentJob
=
optionalJob
;
currentJob
=
optionalJob
;
currentJob
.
get
().
setCurrentProcessor
(
this
);
currentJob
.
get
().
setCurrentProcessor
(
this
);
// System.out.println("Time " + t + ": " + this + " started job " + currentJob.get()
System
.
out
.
println
(
// + " of task" + taskContext
+ "!");
"Time "
+
t
+
": "
+
this
+
" started job "
+
currentJob
.
get
()
+
"!"
);
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
...
src/main/java/mvd/jester/simulator/internals/TaskContextInterface.java
View file @
7999313d
...
@@ -10,7 +10,7 @@ public interface TaskContextInterface {
...
@@ -10,7 +10,7 @@ public interface TaskContextInterface {
public
Task
getTask
();
public
Task
getTask
();
public
Optional
<
TaskContextInterface
>
acceptNotification
();
public
Optional
<
TaskContextInterface
>
acceptNotification
(
long
time
);
public
Optional
<
JobContextInterface
>
getNextJob
();
public
Optional
<
JobContextInterface
>
getNextJob
();
...
...
src/main/java/mvd/jester/simulator/internals/maiabertogna/JobContext.java
View file @
7999313d
...
@@ -31,11 +31,11 @@ public class JobContext implements JobContextInterface {
...
@@ -31,11 +31,11 @@ public class JobContext implements JobContextInterface {
executionTime
--;
executionTime
--;
if
(
executionTime
==
0
)
{
if
(
executionTime
==
0
)
{
//
System.out.println("Time " + time + ": " + currentProcessor.get()
System
.
out
.
println
(
"Time "
+
time
+
": "
+
currentProcessor
.
get
()
//
+ " finished execution of job " + this + "!");
+
" finished execution of job "
+
this
+
"!"
);
currentProcessor
.
get
().
setJob
(
null
);
currentProcessor
.
get
().
setJob
(
null
);
currentProcessor
=
Optional
.
empty
();
currentProcessor
=
Optional
.
empty
();
return
taskContext
.
acceptNotification
();
return
taskContext
.
acceptNotification
(
time
);
}
}
return
Optional
.
empty
();
return
Optional
.
empty
();
...
@@ -83,7 +83,7 @@ public class JobContext implements JobContextInterface {
...
@@ -83,7 +83,7 @@ public class JobContext implements JobContextInterface {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"(jobWcet="
+
wcet
+
")"
;
return
"(jobWcet="
+
wcet
+
"
, of task="
+
taskContext
+
"
)"
;
}
}
}
}
src/main/java/mvd/jester/simulator/internals/maiabertogna/TaskContext.java
View file @
7999313d
...
@@ -45,14 +45,14 @@ public class TaskContext implements TaskContextInterface {
...
@@ -45,14 +45,14 @@ public class TaskContext implements TaskContextInterface {
return
deadline
;
return
deadline
;
}
}
public
Optional
<
TaskContextInterface
>
acceptNotification
()
{
public
Optional
<
TaskContextInterface
>
acceptNotification
(
long
time
)
{
segmentCounter
++;
segmentCounter
++;
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
getNumberOfJobs
())
{
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
getNumberOfJobs
())
{
currentSegment
++;
currentSegment
++;
segmentCounter
=
0
;
segmentCounter
=
0
;
if
(
currentSegment
>=
segments
.
size
())
{
if
(
currentSegment
>=
segments
.
size
())
{
//
System.out.println("Time " + time + ": Task " + this + "finished!");
System
.
out
.
println
(
"Time "
+
time
+
": Task "
+
this
+
"finished!"
);
return
Optional
.
of
(
this
);
return
Optional
.
of
(
this
);
}
}
}
}
...
...
src/main/java/mvd/jester/simulator/internals/schmidmottok/JobContext.java
View file @
7999313d
...
@@ -32,20 +32,23 @@ public class JobContext implements JobContextInterface {
...
@@ -32,20 +32,23 @@ public class JobContext implements JobContextInterface {
public
Optional
<
TaskContextInterface
>
updateExecution
(
long
time
)
{
public
Optional
<
TaskContextInterface
>
updateExecution
(
long
time
)
{
if
(!
currentTasklet
.
isPresent
())
{
if
(!
currentTasklet
.
isPresent
())
{
currentTasklet
=
segmentContext
.
getNextTasklet
();
currentTasklet
=
segmentContext
.
getNextTasklet
();
//
if (currentTasklet.isPresent()) {
if
(
currentTasklet
.
isPresent
())
{
//
System.out.println("Time " + time + ": Job " + this + " started executing tasklet "
System
.
out
.
println
(
"Time "
+
time
+
": Job "
+
this
+
" started executing tasklet "
//
+ currentTasklet.get() + " on Processor " + currentProcessor.get());
+
currentTasklet
.
get
()
+
" on Processor "
+
currentProcessor
.
get
());
//
}
}
}
}
if
(
currentTasklet
.
isPresent
())
{
if
(
currentTasklet
.
isPresent
())
{
currentTasklet
.
get
().
setCurrentJob
(
this
);
currentTasklet
.
get
().
setCurrentJob
(
this
);
return
currentTasklet
.
get
().
updateExecution
();
// Hier update execution time, dann checken if 0, und wenn 0 gleich nächste Tasklet
}
else
{
// auswählen.
return
currentTasklet
.
get
().
updateExecution
(
time
);
}
else
if
(
currentProcessor
.
isPresent
())
{
currentProcessor
.
get
().
setJob
(
null
);
currentProcessor
.
get
().
setJob
(
null
);
currentProcessor
=
Optional
.
empty
();
currentProcessor
=
Optional
.
empty
();
return
Optional
.
empty
();
}
}
return
Optional
.
empty
();
}
}
public
boolean
checkExecutionTime
()
{
public
boolean
checkExecutionTime
()
{
...
...
src/main/java/mvd/jester/simulator/internals/schmidmottok/SegmentContext.java
View file @
7999313d
...
@@ -37,9 +37,16 @@ public class SegmentContext {
...
@@ -37,9 +37,16 @@ public class SegmentContext {
}
}
Optional
<
JobContextInterface
>
getNextJob
()
{
Optional
<
JobContextInterface
>
getNextJob
()
{
return
jobs
.
stream
()
boolean
taskletAvailable
=
tasklets
.
stream
()
.
filter
(
j
->
!
j
.
getCurrentProcessor
().
isPresent
()
&&
j
.
checkExecutionTime
())
.
anyMatch
(
t
->
!
t
.
getCurrentJob
().
isPresent
()
&&
t
.
checkExecutionTime
());
.
findFirst
();
if
(
taskletAvailable
)
{
return
jobs
.
stream
()
.
filter
(
j
->
!
j
.
getCurrentProcessor
().
isPresent
()
&&
j
.
checkExecutionTime
())
.
findFirst
();
}
else
{
return
Optional
.
empty
();
}
}
}
Optional
<
TaskletContext
>
getNextTasklet
()
{
Optional
<
TaskletContext
>
getNextTasklet
()
{
...
...
src/main/java/mvd/jester/simulator/internals/schmidmottok/TaskContext.java
View file @
7999313d
...
@@ -45,14 +45,14 @@ public class TaskContext implements TaskContextInterface {
...
@@ -45,14 +45,14 @@ public class TaskContext implements TaskContextInterface {
return
deadline
;
return
deadline
;
}
}
public
Optional
<
TaskContextInterface
>
acceptNotification
()
{
public
Optional
<
TaskContextInterface
>
acceptNotification
(
long
time
)
{
segmentCounter
++;
segmentCounter
++;
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
getNumberOfTasklets
())
{
if
(
segmentCounter
>=
segments
.
get
(
currentSegment
).
getSegment
().
getNumberOfTasklets
())
{
currentSegment
++;
currentSegment
++;
segmentCounter
=
0
;
segmentCounter
=
0
;
if
(
currentSegment
>=
segments
.
size
())
{
if
(
currentSegment
>=
segments
.
size
())
{
//
System.out.println("Time " + time + ": Task " + this + "finished!");
System
.
out
.
println
(
"Time "
+
time
+
": Task "
+
this
+
"finished!"
);
return
Optional
.
of
(
this
);
return
Optional
.
of
(
this
);
}
}
}
}
...
...
src/main/java/mvd/jester/simulator/internals/schmidmottok/TaskletContext.java
View file @
7999313d
...
@@ -33,13 +33,13 @@ public class TaskletContext {
...
@@ -33,13 +33,13 @@ public class TaskletContext {
currentJob
=
Optional
.
ofNullable
(
jobContext
);
currentJob
=
Optional
.
ofNullable
(
jobContext
);
}
}
public
Optional
<
TaskContextInterface
>
updateExecution
()
{
public
Optional
<
TaskContextInterface
>
updateExecution
(
long
time
)
{
executionTime
--;
executionTime
--;
if
(
executionTime
==
0
)
{
if
(
executionTime
==
0
)
{
currentJob
.
get
().
setCurrentTasklet
(
null
);
currentJob
.
get
().
setCurrentTasklet
(
null
);
currentJob
=
Optional
.
empty
();
currentJob
=
Optional
.
empty
();
return
taskContext
.
acceptNotification
();
return
taskContext
.
acceptNotification
(
time
);
}
}
return
Optional
.
empty
();
return
Optional
.
empty
();
}
}
...
...
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