Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
simso
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
930ac7c0
authored
Nov 25, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit before trying process as member
parent
8e0c1920
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
54 deletions
+66
-54
simso/core/Job.py
+14
-10
simso/core/Monitor.py
+6
-6
simso/core/Processor.py
+25
-18
simso/core/Scheduler.py
+1
-1
simso/core/Task.py
+12
-12
simso/core/Timer.py
+6
-5
simso/core/results.py
+1
-1
simso/schedulers/SCHED_DEADLINE.py
+1
-1
No files found.
simso/core/Job.py
View file @
930ac7c0
...
@@ -28,7 +28,7 @@ class Job(Process):
...
@@ -28,7 +28,7 @@ class Job(Process):
:type etm: AbstractExecutionTimeModel
:type etm: AbstractExecutionTimeModel
:type sim: Model
:type sim: Model
"""
"""
Process
.
__init__
(
self
,
env
=
sim
,
generator
=
self
.
activate_job
())
# TODO: what to pass as generator?
Process
.
__init__
(
self
,
env
=
sim
,
generator
=
self
.
activate_job
())
self
.
_task
=
task
self
.
_task
=
task
self
.
_pred
=
pred
self
.
_pred
=
pred
self
.
instr_count
=
0
# Updated by the cache model.
self
.
instr_count
=
0
# Updated by the cache model.
...
@@ -50,7 +50,10 @@ class Job(Process):
...
@@ -50,7 +50,10 @@ class Job(Process):
self
.
_on_activate
()
self
.
_on_activate
()
self
.
context_ok
=
True
# The context is ready to be loaded.
self
.
processor_ok
=
self
.
_sim
.
event
()
self
.
context_ok
=
self
.
_sim
.
event
()
self
.
context_ok
.
succeed
()
self
.
context_ready
=
True
def
is_active
(
self
):
def
is_active
(
self
):
"""
"""
...
@@ -64,7 +67,7 @@ class Job(Process):
...
@@ -64,7 +67,7 @@ class Job(Process):
self
.
_etm
.
on_activate
(
self
)
self
.
_etm
.
on_activate
(
self
)
def
_on_execute
(
self
):
def
_on_execute
(
self
):
self
.
_last_exec
=
self
.
_sim
.
now
()
self
.
_last_exec
=
self
.
_sim
.
now
self
.
_etm
.
on_execute
(
self
)
self
.
_etm
.
on_execute
(
self
)
if
self
.
_is_preempted
:
if
self
.
_is_preempted
:
...
@@ -78,7 +81,7 @@ class Job(Process):
...
@@ -78,7 +81,7 @@ class Job(Process):
def
_on_stop_exec
(
self
):
def
_on_stop_exec
(
self
):
if
self
.
_last_exec
is
not
None
:
if
self
.
_last_exec
is
not
None
:
self
.
_computation_time
+=
self
.
_sim
.
now
()
-
self
.
_last_exec
self
.
_computation_time
+=
self
.
_sim
.
now
-
self
.
_last_exec
self
.
_last_exec
=
None
self
.
_last_exec
=
None
def
_on_preempted
(
self
):
def
_on_preempted
(
self
):
...
@@ -95,7 +98,7 @@ class Job(Process):
...
@@ -95,7 +98,7 @@ class Job(Process):
self
.
_on_stop_exec
()
self
.
_on_stop_exec
()
self
.
_etm
.
on_terminated
(
self
)
self
.
_etm
.
on_terminated
(
self
)
self
.
_end_date
=
self
.
_sim
.
now
()
self
.
_end_date
=
self
.
_sim
.
now
self
.
_monitor
.
observe
(
JobEvent
(
self
,
JobEvent
.
TERMINATED
))
self
.
_monitor
.
observe
(
JobEvent
(
self
,
JobEvent
.
TERMINATED
))
self
.
_task
.
end_job
(
self
)
self
.
_task
.
end_job
(
self
)
self
.
_task
.
cpu
.
terminate
(
self
)
self
.
_task
.
cpu
.
terminate
(
self
)
...
@@ -104,7 +107,7 @@ class Job(Process):
...
@@ -104,7 +107,7 @@ class Job(Process):
def
_on_abort
(
self
):
def
_on_abort
(
self
):
self
.
_on_stop_exec
()
self
.
_on_stop_exec
()
self
.
_etm
.
on_abort
(
self
)
self
.
_etm
.
on_abort
(
self
)
self
.
_end_date
=
self
.
_sim
.
now
()
self
.
_end_date
=
self
.
_sim
.
now
self
.
_aborted
=
True
self
.
_aborted
=
True
self
.
_monitor
.
observe
(
JobEvent
(
self
,
JobEvent
.
ABORTED
))
self
.
_monitor
.
observe
(
JobEvent
(
self
,
JobEvent
.
ABORTED
))
self
.
_task
.
end_job
(
self
)
self
.
_task
.
end_job
(
self
)
...
@@ -183,7 +186,7 @@ class Job(Process):
...
@@ -183,7 +186,7 @@ class Job(Process):
Dynamic laxity of the job in ms.
Dynamic laxity of the job in ms.
"""
"""
return
(
self
.
absolute_deadline
-
self
.
ret
return
(
self
.
absolute_deadline
-
self
.
ret
)
*
self
.
_sim
.
cycles_per_ms
-
self
.
_sim
.
now
()
)
*
self
.
_sim
.
cycles_per_ms
-
self
.
_sim
.
now
@property
@property
def
computation_time
(
self
):
def
computation_time
(
self
):
...
@@ -201,7 +204,7 @@ class Job(Process):
...
@@ -201,7 +204,7 @@ class Job(Process):
return
int
(
self
.
_computation_time
)
return
int
(
self
.
_computation_time
)
else
:
else
:
return
(
int
(
self
.
_computation_time
)
+
return
(
int
(
self
.
_computation_time
)
+
self
.
_sim
.
now
()
-
self
.
_last_exec
)
self
.
_sim
.
now
-
self
.
_last_exec
)
@property
@property
def
actual_computation_time
(
self
):
def
actual_computation_time
(
self
):
...
@@ -290,7 +293,7 @@ class Job(Process):
...
@@ -290,7 +293,7 @@ class Job(Process):
return
self
.
_pred
return
self
.
_pred
def
activate_job
(
self
):
def
activate_job
(
self
):
self
.
_start_date
=
self
.
_sim
.
now
()
self
.
_start_date
=
self
.
_sim
.
now
# Notify the OS.
# Notify the OS.
self
.
_task
.
cpu
.
activate
(
self
)
self
.
_task
.
cpu
.
activate
(
self
)
...
@@ -298,7 +301,8 @@ class Job(Process):
...
@@ -298,7 +301,8 @@ class Job(Process):
while
self
.
_end_date
is
None
:
while
self
.
_end_date
is
None
:
# Wait an execute order.
# Wait an execute order.
try
:
try
:
yield
self
.
_sim
.
event
()
yield
self
.
processor_ok
self
.
processor_ok
=
self
.
_sim
.
event
()
except
Interrupt
:
except
Interrupt
:
pass
pass
else
:
else
:
...
...
simso/core/Monitor.py
View file @
930ac7c0
...
@@ -18,7 +18,7 @@ class Monitor(list):
...
@@ -18,7 +18,7 @@ class Monitor(list):
def
observe
(
self
,
y
,
t
=
None
):
def
observe
(
self
,
y
,
t
=
None
):
"""record y and t"""
"""record y and t"""
if
t
is
None
:
t
=
self
.
env
.
now
()
if
t
is
None
:
t
=
self
.
env
.
now
self
.
append
([
t
,
y
])
self
.
append
([
t
,
y
])
def
tally
(
self
,
y
):
def
tally
(
self
,
y
):
...
@@ -32,7 +32,7 @@ class Monitor(list):
...
@@ -32,7 +32,7 @@ class Monitor(list):
def
reset
(
self
,
t
=
None
):
def
reset
(
self
,
t
=
None
):
"""reset the sums and counts for the monitored variable """
"""reset the sums and counts for the monitored variable """
self
[:]
=
[]
self
[:]
=
[]
if
t
is
None
:
t
=
self
.
env
.
now
()
if
t
is
None
:
t
=
self
.
env
.
now
self
.
startTime
=
t
self
.
startTime
=
t
def
tseries
(
self
):
def
tseries
(
self
):
...
@@ -81,14 +81,14 @@ class Monitor(list):
...
@@ -81,14 +81,14 @@ class Monitor(list):
The time-weighted average of the monitored variable.
The time-weighted average of the monitored variable.
If t is used it is assumed to be the current time,
If t is used it is assumed to be the current time,
otherwise t = self.sim.now
()
otherwise t = self.sim.now
"""
"""
N
=
self
.
__len__
()
N
=
self
.
__len__
()
if
N
==
0
:
if
N
==
0
:
return
None
return
None
if
t
is
None
:
t
=
self
.
env
.
now
()
if
t
is
None
:
t
=
self
.
env
.
now
sum
=
0.0
sum
=
0.0
tlast
=
self
[
0
][
0
]
tlast
=
self
[
0
][
0
]
ylast
=
self
[
0
][
1
]
ylast
=
self
[
0
][
1
]
...
@@ -107,12 +107,12 @@ class Monitor(list):
...
@@ -107,12 +107,12 @@ class Monitor(list):
""" the time - weighted Variance of the monitored variable.
""" the time - weighted Variance of the monitored variable.
If t is used it is assumed to be the current time,
If t is used it is assumed to be the current time,
otherwise t = self.sim.now
()
otherwise t = self.sim.now
"""
"""
N
=
self
.
__len__
()
N
=
self
.
__len__
()
if
N
==
0
:
if
N
==
0
:
return
None
return
None
if
t
is
None
:
t
=
self
.
env
.
now
()
if
t
is
None
:
t
=
self
.
env
.
now
sm
=
0.0
sm
=
0.0
ssq
=
0.0
ssq
=
0.0
tlast
=
self
[
0
][
0
]
tlast
=
self
[
0
][
0
]
...
...
simso/core/Processor.py
View file @
930ac7c0
...
@@ -54,11 +54,12 @@ class Processor(Process):
...
@@ -54,11 +54,12 @@ class Processor(Process):
cls
.
_identifier
=
0
cls
.
_identifier
=
0
def
__init__
(
self
,
model
,
proc_info
):
def
__init__
(
self
,
model
,
proc_info
):
Process
.
__init__
(
self
,
env
=
model
,
generator
=
self
.
run
())
# TODO: what to pass as generator?
Process
.
__init__
(
self
,
model
,
self
.
run
())
self
.
_model
=
model
self
.
_model
=
model
self
.
_internal_id
=
Processor
.
_identifier
self
.
_internal_id
=
Processor
.
_identifier
Processor
.
_identifier
+=
1
Processor
.
_identifier
+=
1
self
.
identifier
=
proc_info
.
identifier
self
.
identifier
=
proc_info
.
identifier
self
.
name
=
proc_info
.
name
self
.
_running
=
None
self
.
_running
=
None
self
.
was_running
=
None
self
.
was_running
=
None
self
.
_evts
=
deque
([])
self
.
_evts
=
deque
([])
...
@@ -70,7 +71,8 @@ class Processor(Process):
...
@@ -70,7 +71,8 @@ class Processor(Process):
self
.
_cl_overhead
=
proc_info
.
cl_overhead
self
.
_cl_overhead
=
proc_info
.
cl_overhead
self
.
_migration_overhead
=
proc_info
.
migration_overhead
self
.
_migration_overhead
=
proc_info
.
migration_overhead
self
.
set_caches
(
proc_info
.
caches
)
self
.
set_caches
(
proc_info
.
caches
)
self
.
timer_monitor
=
Monitor
(
env
=
model
,
name
=
"Monitor Timer"
+
proc_info
.
name
)
self
.
timer_monitor
=
Monitor
(
env
=
model
,
name
=
"Monitor Timer"
+
proc_info
.
name
)
self
.
_speed
=
proc_info
.
speed
self
.
_speed
=
proc_info
.
speed
def
resched
(
self
):
def
resched
(
self
):
...
@@ -143,34 +145,37 @@ class Processor(Process):
...
@@ -143,34 +145,37 @@ class Processor(Process):
"""
"""
return
self
.
_running
return
self
.
_running
def
waituntil
(
self
,
cond_func
,
delay
=
1
):
while
not
cond_func
():
yield
self
.
env
.
timeout
(
delay
)
def
run
(
self
):
def
run
(
self
):
while
True
:
while
True
:
if
not
self
.
_evts
:
if
not
self
.
_evts
:
job
=
self
.
_running
job
=
self
.
_running
if
job
:
if
job
:
yield
self
.
waituntil
(
lambda
:
job
.
context_ok
)
# yield job.context_ok
while
not
job
.
context_ready
:
yield
self
.
_model
.
timeout
(
1
)
self
.
monitor
.
observe
(
ProcCxtLoadEvent
())
self
.
monitor
.
observe
(
ProcCxtLoadEvent
())
yield
self
.
_model
.
timeout
(
self
.
cl_overhead
)
# overhead load context
# overhead load context
yield
self
.
_model
.
timeout
(
self
.
cl_overhead
)
self
.
monitor
.
observe
(
ProcCxtLoadEvent
(
terminated
=
True
))
self
.
monitor
.
observe
(
ProcCxtLoadEvent
(
terminated
=
True
))
job
.
interruptReset
()
# job.interruptReset() # TODO: does this interrupt need handling?
self
.
env
.
reactivate
(
job
)
job
.
processor_ok
.
succeed
()
job
.
processor_ok
=
self
.
_model
.
event
()
self
.
monitor
.
observe
(
ProcRunEvent
(
job
))
self
.
monitor
.
observe
(
ProcRunEvent
(
job
))
job
.
context_
ok
=
False
job
.
context_
ready
=
False
else
:
else
:
self
.
monitor
.
observe
(
ProcIdleEvent
())
self
.
monitor
.
observe
(
ProcIdleEvent
())
# Wait event.
# Wait event.
yield
self
.
waituntil
(
lambda
:
self
.
_evts
)
while
not
self
.
_evts
:
yield
self
.
_model
.
timeout
(
1
)
if
job
:
if
job
:
self
.
interrupt
(
job
)
self
.
_model
.
interrupt
(
job
)
self
.
monitor
.
observe
(
ProcCxtSaveEvent
())
self
.
monitor
.
observe
(
ProcCxtSaveEvent
())
yield
self
.
_model
.
timeout
(
self
.
cs_overhead
)
# overhead save context
# overhead save context
yield
self
.
_model
.
timeout
(
self
.
cs_overhead
)
self
.
monitor
.
observe
(
ProcCxtSaveEvent
(
terminated
=
True
))
self
.
monitor
.
observe
(
ProcCxtSaveEvent
(
terminated
=
True
))
job
.
context_ok
=
True
# job.context_ok = self._model.event()
job
.
context_ready
=
True
evt
=
self
.
_evts
.
popleft
()
evt
=
self
.
_evts
.
popleft
()
if
evt
[
0
]
==
RESCHED
:
if
evt
[
0
]
==
RESCHED
:
...
@@ -193,7 +198,7 @@ class Processor(Process):
...
@@ -193,7 +198,7 @@ class Processor(Process):
elif
evt
[
0
]
==
TIMER
:
elif
evt
[
0
]
==
TIMER
:
self
.
timer_monitor
.
observe
(
None
)
self
.
timer_monitor
.
observe
(
None
)
if
evt
[
1
]
.
overhead
>
0
:
if
evt
[
1
]
.
overhead
>
0
:
print
(
self
.
env
.
now
()
,
"hold"
,
evt
[
1
]
.
overhead
)
print
(
self
.
_model
.
now
,
"hold"
,
evt
[
1
]
.
overhead
)
yield
self
.
_model
.
timeout
(
evt
[
1
]
.
overhead
)
yield
self
.
_model
.
timeout
(
evt
[
1
]
.
overhead
)
evt
[
1
]
.
call_handler
()
evt
[
1
]
.
call_handler
()
elif
evt
[
0
]
==
SPEED
:
elif
evt
[
0
]
==
SPEED
:
...
@@ -201,9 +206,11 @@ class Processor(Process):
...
@@ -201,9 +206,11 @@ class Processor(Process):
elif
evt
[
0
]
==
RESCHED
:
elif
evt
[
0
]
==
RESCHED
:
self
.
monitor
.
observe
(
ProcOverheadEvent
(
"Scheduling"
))
self
.
monitor
.
observe
(
ProcOverheadEvent
(
"Scheduling"
))
self
.
sched
.
monitor_begin_schedule
(
self
)
self
.
sched
.
monitor_begin_schedule
(
self
)
yield
self
.
waituntil
(
self
.
sched
.
get_lock
)
while
not
self
.
sched
.
get_lock
:
yield
self
.
_model
.
timeout
(
1
)
decisions
=
self
.
sched
.
schedule
(
self
)
decisions
=
self
.
sched
.
schedule
(
self
)
yield
self
.
_model
.
timeout
(
self
.
sched
.
overhead
)
# overhead scheduling
# overhead scheduling
yield
self
.
_model
.
timeout
(
self
.
sched
.
overhead
)
if
type
(
decisions
)
is
not
list
:
if
type
(
decisions
)
is
not
list
:
decisions
=
[
decisions
]
decisions
=
[
decisions
]
decisions
=
[
d
for
d
in
decisions
if
d
is
not
None
]
decisions
=
[
d
for
d
in
decisions
if
d
is
not
None
]
...
...
simso/core/Scheduler.py
View file @
930ac7c0
...
@@ -130,7 +130,7 @@ class Scheduler(object):
...
@@ -130,7 +130,7 @@ class Scheduler(object):
- **sim**: :class:`Model <simso.core.Model.Model>` instance.
\
- **sim**: :class:`Model <simso.core.Model.Model>` instance.
\
Useful to get current time with ``sim.now_ms()`` (in ms) or
\
Useful to get current time with ``sim.now_ms()`` (in ms) or
\
``sim.now
()
`` (in cycles).
``sim.now`` (in cycles).
- **processors**: List of :class:`processors
\
- **processors**: List of :class:`processors
\
<simso.core.Processor.Processor>` handled by this scheduler.
<simso.core.Processor.Processor>` handled by this scheduler.
- **task_list**: List of :class:`tasks <simso.core.Task.GenericTask>`
\
- **task_list**: List of :class:`tasks <simso.core.Task.GenericTask>`
\
...
...
simso/core/Task.py
View file @
930ac7c0
...
@@ -266,7 +266,7 @@ class GenericTask(Process):
...
@@ -266,7 +266,7 @@ class GenericTask(Process):
self
.
_activations_fifo
.
popleft
()
self
.
_activations_fifo
.
popleft
()
if
len
(
self
.
_activations_fifo
)
>
0
:
if
len
(
self
.
_activations_fifo
)
>
0
:
self
.
job
=
self
.
_activations_fifo
[
0
]
self
.
job
=
self
.
_activations_fifo
[
0
]
self
.
env
.
activate
(
self
.
job
,
self
.
job
.
activate_job
())
self
.
_sim
.
process
(
self
.
job
.
activate_job
())
def
_job_killer
(
self
,
job
):
def
_job_killer
(
self
,
job
):
if
job
.
end_date
is
None
and
job
.
computation_time
<
job
.
wcet
:
if
job
.
end_date
is
None
and
job
.
computation_time
<
job
.
wcet
:
...
@@ -281,15 +281,15 @@ class GenericTask(Process):
...
@@ -281,15 +281,15 @@ class GenericTask(Process):
"""
"""
self
.
_job_count
+=
1
self
.
_job_count
+=
1
job
=
Job
(
self
,
"{}_{}"
.
format
(
self
.
name
,
self
.
_job_count
),
pred
,
job
=
Job
(
self
,
"{}_{}"
.
format
(
self
.
name
,
self
.
_job_count
),
pred
,
monitor
=
self
.
_monitor
,
etm
=
self
.
_etm
,
sim
=
self
.
env
)
monitor
=
self
.
_monitor
,
etm
=
self
.
_etm
,
sim
=
self
.
_sim
)
if
len
(
self
.
_activations_fifo
)
==
0
:
if
len
(
self
.
_activations_fifo
)
==
0
:
self
.
job
=
job
self
.
job
=
job
self
.
env
.
process
(
job
.
activate_job
())
self
.
_sim
.
process
(
job
.
activate_job
())
self
.
_activations_fifo
.
append
(
job
)
self
.
_activations_fifo
.
append
(
job
)
self
.
_jobs
.
append
(
job
)
self
.
_jobs
.
append
(
job
)
timer_deadline
=
Timer
(
self
.
env
,
GenericTask
.
_job_killer
,
timer_deadline
=
Timer
(
self
.
_sim
,
GenericTask
.
_job_killer
,
(
self
,
job
),
self
.
deadline
)
(
self
,
job
),
self
.
deadline
)
timer_deadline
.
start
()
timer_deadline
.
start
()
...
@@ -307,7 +307,7 @@ class ATask(GenericTask):
...
@@ -307,7 +307,7 @@ class ATask(GenericTask):
def
execute
(
self
):
def
execute
(
self
):
self
.
_init
()
self
.
_init
()
yield
self
.
env
.
event
()
yield
self
.
_sim
.
event
()
class
PTask
(
GenericTask
):
class
PTask
(
GenericTask
):
...
@@ -320,13 +320,13 @@ class PTask(GenericTask):
...
@@ -320,13 +320,13 @@ class PTask(GenericTask):
def
execute
(
self
):
def
execute
(
self
):
self
.
_init
()
self
.
_init
()
# wait the activation date.
# wait the activation date.
yield
self
.
env
.
timeout
(
int
(
self
.
_task_info
.
activation_date
*
yield
self
.
_sim
.
timeout
(
int
(
self
.
_task_info
.
activation_date
*
self
.
_sim
.
cycles_per_ms
))
self
.
_sim
.
cycles_per_ms
))
while
True
:
while
True
:
# print self.sim.now
()
, "activate", self.name
# print self.sim.now, "activate", self.name
self
.
create_job
()
self
.
create_job
()
yield
self
.
env
.
timeout
(
int
(
self
.
period
*
self
.
_sim
.
cycles_per_ms
))
yield
self
.
_sim
.
timeout
(
int
(
self
.
period
*
self
.
_sim
.
cycles_per_ms
))
class
SporadicTask
(
GenericTask
):
class
SporadicTask
(
GenericTask
):
...
@@ -340,8 +340,8 @@ class SporadicTask(GenericTask):
...
@@ -340,8 +340,8 @@ class SporadicTask(GenericTask):
self
.
_init
()
self
.
_init
()
for
ndate
in
self
.
list_activation_dates
:
for
ndate
in
self
.
list_activation_dates
:
yield
self
.
env
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
-
self
.
_sim
.
now
()
)
-
self
.
_sim
.
now
)
self
.
create_job
()
self
.
create_job
()
@property
@property
...
@@ -360,8 +360,8 @@ class ProbabilisticTask(GenericTask):
...
@@ -360,8 +360,8 @@ class ProbabilisticTask(GenericTask):
self
.
_init
()
self
.
_init
()
for
ndate
in
self
.
list_activation_dates
:
for
ndate
in
self
.
list_activation_dates
:
yield
self
.
env
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
-
self
.
_sim
.
now
()
)
-
self
.
_sim
.
now
)
self
.
create_job
()
self
.
create_job
()
@property
@property
...
...
simso/core/Timer.py
View file @
930ac7c0
...
@@ -8,7 +8,8 @@ from simpy import Environment, Process, Interrupt
...
@@ -8,7 +8,8 @@ from simpy import Environment, Process, Interrupt
class
InstanceTimer
(
Process
):
class
InstanceTimer
(
Process
):
def
__init__
(
self
,
timer
):
def
__init__
(
self
,
timer
):
Process
.
__init__
(
self
,
env
=
timer
.
env
,
generator
=
self
.
run
())
Process
.
__init__
(
self
,
env
=
timer
.
_sim
,
generator
=
self
.
run
())
self
.
_sim
=
timer
.
_sim
self
.
function
=
timer
.
function
self
.
function
=
timer
.
function
self
.
args
=
timer
.
args
self
.
args
=
timer
.
args
self
.
delay
=
timer
.
delay
self
.
delay
=
timer
.
delay
...
@@ -25,12 +26,12 @@ class InstanceTimer(Process):
...
@@ -25,12 +26,12 @@ class InstanceTimer(Process):
self
.
running
=
True
self
.
running
=
True
while
self
.
running
:
while
self
.
running
:
try
:
try
:
yield
self
.
env
.
timeout
(
self
.
delay
)
yield
self
.
_sim
.
timeout
(
self
.
delay
)
except
Interrupt
:
except
Interrupt
:
break
break
else
:
else
:
if
not
self
.
running
:
if
not
self
.
running
:
break
;
break
if
self
.
cpu
:
if
self
.
cpu
:
self
.
cpu
.
timer
(
self
)
self
.
cpu
.
timer
(
self
)
else
:
else
:
...
@@ -72,7 +73,7 @@ class Timer(object):
...
@@ -72,7 +73,7 @@ class Timer(object):
Methods:
Methods:
"""
"""
self
.
env
=
sim
self
.
_sim
=
sim
self
.
function
=
function
self
.
function
=
function
self
.
args
=
args
self
.
args
=
args
if
in_ms
:
if
in_ms
:
...
@@ -94,7 +95,7 @@ class Timer(object):
...
@@ -94,7 +95,7 @@ class Timer(object):
Start the timer.
Start the timer.
"""
"""
self
.
instance
=
InstanceTimer
(
self
)
self
.
instance
=
InstanceTimer
(
self
)
self
.
env
.
process
(
self
.
instance
.
run
())
# TODO: , self.prior what's with this?
self
.
_sim
.
process
(
self
.
instance
.
run
())
# TODO: , self.prior what's with this?
def
stop
(
self
):
def
stop
(
self
):
"""
"""
...
...
simso/core/results.py
View file @
930ac7c0
...
@@ -335,7 +335,7 @@ class Results(object):
...
@@ -335,7 +335,7 @@ class Results(object):
Get the observation window.
Get the observation window.
"""
"""
if
self
.
_observation_window
is
None
:
if
self
.
_observation_window
is
None
:
self
.
_observation_window
=
(
0
,
self
.
model
.
now
()
)
self
.
_observation_window
=
(
0
,
self
.
model
.
now
)
return
self
.
_observation_window
return
self
.
_observation_window
def
set_observation_window
(
self
,
window
):
def
set_observation_window
(
self
,
window
):
...
...
simso/schedulers/SCHED_DEADLINE.py
View file @
930ac7c0
...
@@ -83,7 +83,7 @@ class SCHED_DEADLINE(Scheduler):
...
@@ -83,7 +83,7 @@ class SCHED_DEADLINE(Scheduler):
if
(
cpu_min
.
running
is
None
or
if
(
cpu_min
.
running
is
None
or
self
.
cbs_servers
[
cpu_min
.
running
.
task
]
.
current_deadline
>
self
.
cbs_servers
[
self
.
cbs_servers
[
cpu_min
.
running
.
task
]
.
current_deadline
>
self
.
cbs_servers
[
job
.
task
]
.
current_deadline
):
job
.
task
]
.
current_deadline
):
print
(
self
.
sim
.
now
()
,
job
.
name
,
cpu_min
.
name
)
print
(
self
.
sim
.
now
,
job
.
name
,
cpu_min
.
name
)
# start runtime timer of the new server selected
# start runtime timer of the new server selected
self
.
cbs_servers
[
job
.
task
]
.
timer_runtime
=
Timer
(
self
.
sim
,
SCHED_DEADLINE
.
runtime_call
,
self
.
cbs_servers
[
job
.
task
]
.
timer_runtime
=
Timer
(
self
.
sim
,
SCHED_DEADLINE
.
runtime_call
,
...
...
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