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
8e0c1920
authored
4 years ago
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes to now
parent
d7ec2fb6
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
68 additions
and
68 deletions
+68
-68
simso/core/etm/ACET.py
+3
-3
simso/core/etm/CacheModel.py
+3
-3
simso/core/etm/FixedPenalty.py
+4
-4
simso/core/etm/PWCET.py
+3
-3
simso/core/etm/WCET.py
+3
-3
simso/schedulers/BF.py
+3
-3
simso/schedulers/DP_WRAP.py
+2
-2
simso/schedulers/EDF.py
+1
-1
simso/schedulers/EDZL.py
+1
-1
simso/schedulers/EKG.py
+2
-2
simso/schedulers/EPDF.py
+1
-1
simso/schedulers/ER_PD2.py
+1
-1
simso/schedulers/G_FL_ZL.py
+2
-2
simso/schedulers/LLREF.py
+4
-4
simso/schedulers/LLREF2.py
+5
-5
simso/schedulers/LRE_TL.py
+14
-14
simso/schedulers/MLLF.py
+1
-1
simso/schedulers/NVNLF.py
+6
-6
simso/schedulers/PD2.py
+2
-2
simso/schedulers/RUN.py
+2
-2
simso/schedulers/RUNServer.py
+2
-2
simso/schedulers/U_EDF.py
+3
-3
No files found.
simso/core/etm/ACET.py
View file @
8e0c1920
...
...
@@ -18,7 +18,7 @@ class ACET(AbstractExecutionTimeModel):
def
update_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
]
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
]
)
*
job
.
cpu
.
speed
del
self
.
on_execute_date
[
job
]
...
...
@@ -31,7 +31,7 @@ class ACET(AbstractExecutionTimeModel):
)
*
self
.
sim
.
cycles_per_ms
def
on_execute
(
self
,
job
):
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
()
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
def
on_preempted
(
self
,
job
):
self
.
update_executed
(
job
)
...
...
@@ -46,7 +46,7 @@ class ACET(AbstractExecutionTimeModel):
def
get_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
c
=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
c
=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
else
:
c
=
0
return
self
.
executed
[
job
]
+
c
...
...
This diff is collapsed.
Click to expand it.
simso/core/etm/CacheModel.py
View file @
8e0c1920
...
...
@@ -80,14 +80,14 @@ class CacheModel(AbstractExecutionTimeModel):
def
_update_instructions
(
self
):
for
job
in
self
.
_running_jobs
:
# Compute number of instr for self.sim.now
()
- last_update
# Compute number of instr for self.sim.now - last_update
instr
=
compute_instructions
(
job
.
task
,
self
.
_running_jobs
,
self
.
sim
.
now
()
-
self
.
_last_update
)
self
.
sim
.
now
-
self
.
_last_update
)
# Update the number of instr for this job
self
.
_instr_jobs
[
job
]
=
self
.
_instr_jobs
.
get
(
job
,
0
)
+
instr
# Update last_update
self
.
_last_update
=
self
.
sim
.
now
()
self
.
_last_update
=
self
.
sim
.
now
def
on_activate
(
self
,
job
):
self
.
penalty
[
job
]
=
0
...
...
This diff is collapsed.
Click to expand it.
simso/core/etm/FixedPenalty.py
View file @
8e0c1920
...
...
@@ -16,7 +16,7 @@ class FixedPenalty(AbstractExecutionTimeModel):
def
update_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
]
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
]
)
*
job
.
cpu
.
speed
del
self
.
on_execute_date
[
job
]
...
...
@@ -26,7 +26,7 @@ class FixedPenalty(AbstractExecutionTimeModel):
self
.
executed
[
job
]
=
0
def
on_execute
(
self
,
job
):
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
()
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
if
job
in
self
.
was_running_on
:
# resume on the same processor.
if
self
.
was_running_on
[
job
]
is
job
.
cpu
:
...
...
@@ -39,7 +39,7 @@ class FixedPenalty(AbstractExecutionTimeModel):
self
.
was_running_on
[
job
]
=
job
.
cpu
def
on_preempted
(
self
,
job
):
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
]
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
]
)
*
job
.
cpu
.
speed
def
on_terminated
(
self
,
job
):
...
...
@@ -52,7 +52,7 @@ class FixedPenalty(AbstractExecutionTimeModel):
def
get_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
c
=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
c
=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
else
:
c
=
0
return
self
.
executed
[
job
]
+
c
...
...
This diff is collapsed.
Click to expand it.
simso/core/etm/PWCET.py
View file @
8e0c1920
...
...
@@ -14,7 +14,7 @@ class PWCET(AbstractExecutionTimeModel):
def
update_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
]
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
]
)
*
job
.
cpu
.
speed
del
self
.
on_execute_date
[
job
]
...
...
@@ -25,7 +25,7 @@ class PWCET(AbstractExecutionTimeModel):
0
,
1
)
<=
x
[
1
])
*
self
.
sim
.
cycles_per_ms
def
on_execute
(
self
,
job
):
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
()
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
def
on_preempted
(
self
,
job
):
self
.
update_executed
(
job
)
...
...
@@ -38,7 +38,7 @@ class PWCET(AbstractExecutionTimeModel):
def
get_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
c
=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
c
=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
else
:
c
=
0
return
self
.
executed
[
job
]
+
c
...
...
This diff is collapsed.
Click to expand it.
simso/core/etm/WCET.py
View file @
8e0c1920
...
...
@@ -13,7 +13,7 @@ class WCET(AbstractExecutionTimeModel):
def
update_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
]
self
.
executed
[
job
]
+=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
]
)
*
job
.
cpu
.
speed
del
self
.
on_execute_date
[
job
]
...
...
@@ -22,7 +22,7 @@ class WCET(AbstractExecutionTimeModel):
self
.
executed
[
job
]
=
0
def
on_execute
(
self
,
job
):
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
()
self
.
on_execute_date
[
job
]
=
self
.
sim
.
now
def
on_preempted
(
self
,
job
):
self
.
update_executed
(
job
)
...
...
@@ -35,7 +35,7 @@ class WCET(AbstractExecutionTimeModel):
def
get_executed
(
self
,
job
):
if
job
in
self
.
on_execute_date
:
c
=
(
self
.
sim
.
now
()
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
c
=
(
self
.
sim
.
now
-
self
.
on_execute_date
[
job
])
*
job
.
cpu
.
speed
else
:
c
=
0
return
self
.
executed
[
job
]
+
c
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/BF.py
View file @
8e0c1920
...
...
@@ -82,7 +82,7 @@ class BF(Scheduler):
self
.
t_f
=
int
(
min
([
x
.
job
.
absolute_deadline
for
x
in
self
.
task_list
])
*
self
.
sim
.
cycles_per_ms
)
# Duration that can be allocated for each processor.
w
=
int
(
self
.
t_f
-
self
.
sim
.
now
()
)
w
=
int
(
self
.
t_f
-
self
.
sim
.
now
)
available
=
w
*
len
(
self
.
processors
)
p
=
0
# Processor id.
...
...
@@ -91,7 +91,7 @@ class BF(Scheduler):
print
(
"{:#^60}"
.
format
(
" Scheduling Interval [{},{}) "
.
format
(
self
.
sim
.
now
()
/
self
.
sim
.
cycles_per_ms
,
self
.
sim
.
now
/
self
.
sim
.
cycles_per_ms
,
self
.
t_f
/
self
.
sim
.
cycles_per_ms
)))
for
task
in
self
.
task_list
:
if
not
task
.
job
.
is_active
():
...
...
@@ -191,7 +191,7 @@ class BF(Scheduler):
"""
self
.
waiting_schedule
=
False
# At the end of the interval:
if
self
.
sim
.
now
()
>=
self
.
t_f
:
if
self
.
sim
.
now
>=
self
.
t_f
:
self
.
init_interval
()
# Stop current timers.
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/DP_WRAP.py
View file @
8e0c1920
...
...
@@ -37,7 +37,7 @@ class DP_WRAP(Scheduler):
self
.
t_f
=
ceil
(
min
([
x
.
job
.
absolute_deadline
for
x
in
self
.
task_list
]
)
*
self
.
sim
.
cycles_per_ms
)
# Duration that can be allocated for each processor.
w
=
int
(
self
.
t_f
-
self
.
sim
.
now
()
)
w
=
int
(
self
.
t_f
-
self
.
sim
.
now
)
p
=
0
# Processor id.
for
task
in
self
.
task_list
:
job
=
task
.
job
...
...
@@ -99,7 +99,7 @@ class DP_WRAP(Scheduler):
"""
self
.
waiting_schedule
=
False
# At the end of the interval:
if
self
.
sim
.
now
()
>=
self
.
t_f
:
if
self
.
sim
.
now
>=
self
.
t_f
:
self
.
init_interval
()
# Stop current timers.
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/EDF.py
View file @
8e0c1920
...
...
@@ -34,5 +34,5 @@ class EDF(Scheduler):
if
(
cpu_min
.
running
is
None
or
cpu_min
.
running
.
absolute_deadline
>
job
.
absolute_deadline
):
print
(
self
.
sim
.
now
()
,
job
.
name
,
cpu_min
.
name
)
print
(
self
.
sim
.
now
,
job
.
name
,
cpu_min
.
name
)
return
(
job
,
cpu_min
)
This diff is collapsed.
Click to expand it.
simso/schedulers/EDZL.py
View file @
8e0c1920
...
...
@@ -32,7 +32,7 @@ class EDZL(Scheduler):
job
.
priority
=
0
job
.
cpu
.
resched
()
else
:
print
(
self
.
sim
.
now
()
,
job
.
name
)
print
(
self
.
sim
.
now
,
job
.
name
)
def
schedule
(
self
,
cpu
):
"""
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/EKG.py
View file @
8e0c1920
...
...
@@ -30,7 +30,7 @@ class Modified_EDF(Scheduler):
self
.
migrating_task1
,
self
.
migrating_task2
=
\
self
.
migrating_task2
,
self
.
migrating_task1
if
self
.
migrating_task1
:
time_a
=
ceil
((
next_deadline
-
self
.
sim
.
now
()
)
time_a
=
ceil
((
next_deadline
-
self
.
sim
.
now
)
*
self
.
migrating_task1
[
1
])
self
.
timer_a
=
Timer
(
self
.
sim
,
Modified_EDF
.
on_end_migrating1
,
(
self
,),
time_a
,
cpu
=
self
.
processors
[
0
],
...
...
@@ -39,7 +39,7 @@ class Modified_EDF(Scheduler):
self
.
migrating_job2
=
None
if
self
.
migrating_task2
:
time_b
=
int
((
next_deadline
-
self
.
sim
.
now
()
)
time_b
=
int
((
next_deadline
-
self
.
sim
.
now
)
*
(
1
-
self
.
migrating_task2
[
1
]))
self
.
timer_b
=
Timer
(
self
.
sim
,
Modified_EDF
.
on_start_migrating2
,
(
self
,),
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/EPDF.py
View file @
8e0c1920
...
...
@@ -45,7 +45,7 @@ class EPDF(Scheduler):
pseudo_job
=
EPDF
.
PseudoJob
(
job
,
pseudo_job
.
seq
+
1
)
timer
=
Timer
(
self
.
sim
,
EPDF
.
pseudo_activate
,
(
self
,
pseudo_job
),
pseudo_job
.
release_date
*
self
.
quantum
-
self
.
sim
.
now
()
/
self
.
sim
.
cycles_per_ms
+
self
.
sim
.
now
/
self
.
sim
.
cycles_per_ms
+
job
.
activation_date
,
cpu
=
job
.
cpu
,
in_ms
=
True
)
timer
.
start
()
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/ER_PD2.py
View file @
8e0c1920
...
...
@@ -139,7 +139,7 @@ class ER_PD2(Scheduler):
virtual_job
=
VirtualJob
(
job
)
self
.
ready_list
.
append
(
virtual_job
)
if
self
.
sim
.
now
()
==
0
:
if
self
.
sim
.
now
==
0
:
self
.
reschedule
()
def
schedule
(
self
,
cpu
):
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/G_FL_ZL.py
View file @
8e0c1920
...
...
@@ -29,7 +29,7 @@ class G_FL_ZL(Scheduler):
job
.
priority
=
0
job
.
cpu
.
resched
()
else
:
print
(
self
.
sim
.
now
()
,
job
.
name
)
print
(
self
.
sim
.
now
,
job
.
name
)
def
schedule
(
self
,
cpu
):
"""
...
...
@@ -55,7 +55,7 @@ class G_FL_ZL(Scheduler):
minimum
=
None
for
job
in
self
.
ready_list
:
zl_date
=
int
((
job
.
absolute_deadline
-
job
.
ret
)
*
self
.
sim
.
cycles_per_ms
-
self
.
sim
.
now
()
)
)
*
self
.
sim
.
cycles_per_ms
-
self
.
sim
.
now
)
if
(
minimum
is
None
or
minimum
[
0
]
>
zl_date
)
and
zl_date
>
0
:
minimum
=
(
zl_date
,
job
)
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/LLREF.py
View file @
8e0c1920
...
...
@@ -31,7 +31,7 @@ class LLREF(Scheduler):
Deal with a job activation. The budget for this job is computed.
"""
# Compute budget for this newly activated job
window
=
self
.
next_deadline
-
self
.
sim
.
now
()
window
=
self
.
next_deadline
-
self
.
sim
.
now
self
.
budget
[
job
]
=
window
*
job
.
wcet
/
job
.
period
# Find the next absolute deadline among the ready jobs.
...
...
@@ -56,14 +56,14 @@ class LLREF(Scheduler):
"""
Remove budget from the currently executing jobs.
"""
time_since_last_update
=
self
.
sim
.
now
()
-
self
.
last_update
time_since_last_update
=
self
.
sim
.
now
-
self
.
last_update
for
job
in
self
.
selected_jobs
:
if
job
in
self
.
budget
:
if
job
.
is_active
():
self
.
budget
[
job
]
-=
time_since_last_update
else
:
del
self
.
budget
[
job
]
self
.
last_update
=
self
.
sim
.
now
()
self
.
last_update
=
self
.
sim
.
now
def
date_next_event
(
self
,
selected
,
not_selected
):
next_event
=
0
...
...
@@ -73,7 +73,7 @@ class LLREF(Scheduler):
next_event
=
next_bottom_hitting
if
not_selected
:
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
()
\
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
\
-
not_selected
[
0
][
1
]
if
next_ceiling_hitting
<
next_bottom_hitting
:
next_event
=
next_ceiling_hitting
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/LLREF2.py
View file @
8e0c1920
...
...
@@ -34,7 +34,7 @@ class LLREF2(Scheduler):
return
# Compute budget for this newly activated job
window
=
self
.
next_deadline
-
self
.
sim
.
now
()
window
=
self
.
next_deadline
-
self
.
sim
.
now
self
.
budget
[
job
]
=
window
*
job
.
wcet
/
job
.
period
# Find the next absolute deadline among the ready jobs.
...
...
@@ -59,14 +59,14 @@ class LLREF2(Scheduler):
"""
Remove budget from the currently executing jobs.
"""
time_since_last_update
=
self
.
sim
.
now
()
-
self
.
last_update
time_since_last_update
=
self
.
sim
.
now
-
self
.
last_update
for
job
in
self
.
selected_jobs
:
if
job
in
self
.
budget
:
if
job
.
is_active
():
self
.
budget
[
job
]
-=
time_since_last_update
else
:
del
self
.
budget
[
job
]
self
.
last_update
=
self
.
sim
.
now
()
self
.
last_update
=
self
.
sim
.
now
def
date_next_event
(
self
,
selected
,
not_selected
):
next_event
=
None
...
...
@@ -76,7 +76,7 @@ class LLREF2(Scheduler):
next_event
=
next_bottom_hitting
if
not_selected
:
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
()
\
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
\
-
ceil
(
max
(
y
for
_
,
y
in
not_selected
))
if
next_event
is
None
or
next_ceiling_hitting
<
next_event
:
next_event
=
next_ceiling_hitting
...
...
@@ -84,7 +84,7 @@ class LLREF2(Scheduler):
return
next_event
if
next_event
else
0
def
select_jobs
(
self
):
window
=
self
.
next_deadline
-
self
.
sim
.
now
()
window
=
self
.
next_deadline
-
self
.
sim
.
now
res
=
[(
job
,
b
)
for
job
,
b
in
self
.
budget
.
items
()
if
window
<=
ceil
(
b
)
and
job
.
is_active
()]
for
job
,
b
in
sorted
(
self
.
budget
.
items
(),
key
=
lambda
x
:
-
x
[
1
]):
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/LRE_TL.py
View file @
8e0c1920
...
...
@@ -50,7 +50,7 @@ class LRE_TL(Scheduler):
if
dl
not
in
self
.
h_d
:
heappush
(
self
.
h_d
,
dl
)
self
.
t_f
=
self
.
sim
.
now
()
+
self
.
pmin
self
.
t_f
=
self
.
sim
.
now
+
self
.
pmin
if
self
.
h_d
[
0
]
<=
self
.
t_f
:
self
.
t_f
=
heappop
(
self
.
h_d
)
...
...
@@ -58,9 +58,9 @@ class LRE_TL(Scheduler):
self
.
h_b
=
[]
self
.
h_c
=
[]
for
task
in
self
.
task_list
:
l
=
ceil
(
task
.
wcet
*
(
self
.
t_f
-
self
.
sim
.
now
()
)
/
task
.
period
)
l
=
ceil
(
task
.
wcet
*
(
self
.
t_f
-
self
.
sim
.
now
)
/
task
.
period
)
if
z
<
len
(
self
.
processors
)
and
task
.
job
.
is_active
():
heappush
(
self
.
h_b
,
(
self
.
sim
.
now
()
+
l
,
task
))
heappush
(
self
.
h_b
,
(
self
.
sim
.
now
+
l
,
task
))
decisions
.
append
((
task
.
job
,
self
.
processors
[
z
]))
z
+=
1
else
:
...
...
@@ -82,18 +82,18 @@ class LRE_TL(Scheduler):
tasks_h_b
=
[
t
for
_
,
t
in
self
.
h_b
]
if
task
not
in
tasks_h_b
and
task
not
in
tasks_h_c
:
l
=
ceil
(
task
.
wcet
*
(
self
.
t_f
-
self
.
sim
.
now
()
)
/
task
.
period
)
l
=
ceil
(
task
.
wcet
*
(
self
.
t_f
-
self
.
sim
.
now
)
/
task
.
period
)
if
len
(
self
.
h_b
)
<
len
(
self
.
processors
):
idle_proc
=
[
z
for
z
in
self
.
processors
if
not
z
.
is_running
()][
0
]
decisions
.
append
((
task
.
job
,
idle_proc
))
heappush
(
self
.
h_b
,
(
self
.
sim
.
now
()
+
l
,
task
))
heappush
(
self
.
h_b
,
(
self
.
sim
.
now
+
l
,
task
))
else
:
if
task
.
wcet
<
task
.
period
:
heappush
(
self
.
h_c
,
((
self
.
t_f
-
l
),
task
))
else
:
key_b
,
task_b
=
heapreplace
(
self
.
h_b
,
(
self
.
t_f
+
l
,
task
))
heappush
(
self
.
h_c
,
(
self
.
t_f
-
key_b
+
self
.
sim
.
now
()
))
heappush
(
self
.
h_c
,
(
self
.
t_f
-
key_b
+
self
.
sim
.
now
))
dl
=
int
(
task
.
job
.
absolute_deadline
*
self
.
sim
.
cycles_per_ms
)
if
dl
not
in
self
.
h_d
:
...
...
@@ -107,23 +107,23 @@ class LRE_TL(Scheduler):
"""
decisions
=
[]
while
self
.
h_b
and
self
.
h_b
[
0
][
0
]
==
self
.
sim
.
now
()
:
while
self
.
h_b
and
self
.
h_b
[
0
][
0
]
==
self
.
sim
.
now
:
task_b
=
heappop
(
self
.
h_b
)[
1
]
if
self
.
h_c
:
key_c
,
task_c
=
heappop
(
self
.
h_c
)
heappush
(
self
.
h_b
,
(
self
.
t_f
-
key_c
+
self
.
sim
.
now
()
,
task_c
))
heappush
(
self
.
h_b
,
(
self
.
t_f
-
key_c
+
self
.
sim
.
now
,
task_c
))
decisions
.
append
((
task_c
.
job
,
task_b
.
cpu
))
else
:
decisions
.
append
((
None
,
task_b
.
cpu
))
if
self
.
h_c
:
while
self
.
h_c
[
0
][
0
]
==
self
.
sim
.
now
()
:
while
self
.
h_c
[
0
][
0
]
==
self
.
sim
.
now
:
key_b
,
task_b
=
heappop
(
self
.
h_b
)
key_c
,
task_c
=
heappop
(
self
.
h_c
)
key_b
=
self
.
t_f
-
key_b
+
self
.
sim
.
now
()
key_b
=
self
.
t_f
-
key_b
+
self
.
sim
.
now
assert
key_c
!=
key_b
,
"Handle Evt BC failed."
key_c
=
self
.
t_f
-
key_c
+
self
.
sim
.
now
()
key_c
=
self
.
t_f
-
key_c
+
self
.
sim
.
now
heappush
(
self
.
h_b
,
(
key_c
,
task_c
))
heappush
(
self
.
h_c
,
(
key_b
,
task_b
))
decisions
.
append
((
task_c
.
job
,
task_b
.
cpu
))
...
...
@@ -146,7 +146,7 @@ class LRE_TL(Scheduler):
self
.
h_c
=
[(
d
,
t
)
for
d
,
t
in
self
.
h_c
if
t
.
job
.
is_active
()]
heapify
(
self
.
h_c
)
if
self
.
sim
.
now
()
==
self
.
t_f
:
if
self
.
sim
.
now
==
self
.
t_f
:
decisions
=
self
.
init_tl_plane
()
else
:
for
task
in
self
.
activations
:
...
...
@@ -163,11 +163,11 @@ class LRE_TL(Scheduler):
t_next
=
min
(
t_next
,
self
.
h_c
[
0
][
0
])
self
.
timer
=
Timer
(
self
.
sim
,
LRE_TL
.
event_bc
,
(
self
,),
t_next
-
self
.
sim
.
now
()
,
t_next
-
self
.
sim
.
now
,
cpu
=
self
.
processors
[
0
],
in_ms
=
False
)
else
:
self
.
timer
=
Timer
(
self
.
sim
,
LRE_TL
.
reschedule
,
(
self
,),
self
.
t_f
-
self
.
sim
.
now
()
,
self
.
t_f
-
self
.
sim
.
now
,
cpu
=
self
.
processors
[
0
],
in_ms
=
False
)
self
.
timer
.
start
()
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/MLLF.py
View file @
8e0c1920
...
...
@@ -37,7 +37,7 @@ class MLLF(Scheduler):
if
len
(
self
.
ready_list
)
>
m
:
ta
=
self
.
ready_list
[
m
-
1
]
dmin
=
self
.
ready_list
[
m
]
.
absolute_deadline
*
\
self
.
sim
.
cycles_per_ms
-
self
.
sim
.
now
()
self
.
sim
.
cycles_per_ms
-
self
.
sim
.
now
if
self
.
timer
:
self
.
timer
.
stop
()
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/NVNLF.py
View file @
8e0c1920
...
...
@@ -41,7 +41,7 @@ class NVNLF(Scheduler):
for
task
in
self
.
task_list
])
\
*
self
.
sim
.
cycles_per_ms
window
=
self
.
next_deadline
-
self
.
sim
.
now
()
window
=
self
.
next_deadline
-
self
.
sim
.
now
for
j
in
self
.
budget
.
keys
():
self
.
budget
[
j
]
=
ceil
(
window
*
j
.
wcet
/
j
.
period
)
...
...
@@ -66,7 +66,7 @@ class NVNLF(Scheduler):
self
.
budget
[
j
]
+=
a
L
-=
a
self
.
last_update
=
self
.
sim
.
now
()
self
.
last_update
=
self
.
sim
.
now
# There's a new job, the system should be rescheduled.
self
.
reschedule
()
...
...
@@ -79,14 +79,14 @@ class NVNLF(Scheduler):
"""
Remove budget from the currently executing jobs.
"""
time_since_last_update
=
self
.
sim
.
now
()
-
self
.
last_update
time_since_last_update
=
self
.
sim
.
now
-
self
.
last_update
for
job
in
self
.
selected_jobs
:
if
job
in
self
.
budget
:
if
job
.
is_active
():
self
.
budget
[
job
]
-=
time_since_last_update
else
:
del
self
.
budget
[
job
]
self
.
last_update
=
self
.
sim
.
now
()
self
.
last_update
=
self
.
sim
.
now
def
date_next_event
(
self
,
selected
,
not_selected
):
next_event
=
None
...
...
@@ -96,7 +96,7 @@ class NVNLF(Scheduler):
next_event
=
next_bottom_hitting
if
not_selected
:
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
()
\
next_ceiling_hitting
=
self
.
next_deadline
-
self
.
sim
.
now
\
-
ceil
(
max
(
y
for
_
,
y
in
not_selected
))
if
next_event
is
None
or
next_ceiling_hitting
<
next_event
:
next_event
=
next_ceiling_hitting
...
...
@@ -104,7 +104,7 @@ class NVNLF(Scheduler):
return
next_event
if
next_event
else
0
def
select_jobs
(
self
):
window
=
self
.
next_deadline
-
self
.
sim
.
now
()
window
=
self
.
next_deadline
-
self
.
sim
.
now
res
=
[(
job
,
b
)
for
job
,
b
in
self
.
budget
.
items
()
if
window
<=
ceil
(
b
)
and
job
.
is_active
()]
for
job
,
b
in
self
.
budget
.
items
():
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/PD2.py
View file @
8e0c1920
...
...
@@ -141,7 +141,7 @@ class PD2(Scheduler):
virtual_job
=
VirtualJob
(
job
)
self
.
ready_list
.
append
(
virtual_job
)
if
self
.
sim
.
now
()
==
0
:
if
self
.
sim
.
now
==
0
:
self
.
reschedule
()
def
schedule
(
self
,
cpu
):
...
...
@@ -153,7 +153,7 @@ class PD2(Scheduler):
self
.
virtual_terminate
(
vjob
)
vjobs
=
[
vjob
for
vjob
in
self
.
ready_list
if
vjob
.
job
.
is_active
()
and
self
.
sim
.
now
()
>=
vjob
.
get_current_job
()
.
absolute_releasedate
]
self
.
sim
.
now
>=
vjob
.
get_current_job
()
.
absolute_releasedate
]
self
.
running_vjobs
=
sorted
(
vjobs
,
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/RUN.py
View file @
8e0c1920
...
...
@@ -176,10 +176,10 @@ class ProperSubsystem(object):
"""
Update the budget of the servers.
"""
time_since_last_update
=
self
.
sim
.
now
()
-
self
.
last_update
time_since_last_update
=
self
.
sim
.
now
-
self
.
last_update
for
server
in
self
.
virtual
:
server
.
budget
-=
time_since_last_update
self
.
last_update
=
self
.
sim
.
now
()
self
.
last_update
=
self
.
sim
.
now
def
resched
(
self
,
cpu
):
"""
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/RUNServer.py
View file @
8e0c1920
...
...
@@ -87,9 +87,9 @@ def add_job(sim, job, server):
"""
server
.
job
=
job
while
server
:
server
.
add_deadline
(
sim
.
now
()
,
job
.
absolute_deadline
*
server
.
add_deadline
(
sim
.
now
,
job
.
absolute_deadline
*
sim
.
cycles_per_ms
)
server
.
create_job
(
sim
.
now
()
)
server
.
create_job
(
sim
.
now
)
server
=
server
.
parent
...
...
This diff is collapsed.
Click to expand it.
simso/schedulers/U_EDF.py
View file @
8e0c1920
...
...
@@ -44,7 +44,7 @@ class U_EDF(Scheduler):
job
,
j
,
job
.
absolute_deadline
*
self
.
sim
.
cycles_per_ms
,
t2
)
def
compute_al
(
self
):
t
=
self
.
sim
.
now
()
t
=
self
.
sim
.
now
cycles_per_ms
=
self
.
sim
.
cycles_per_ms
self
.
sorted_task_list
=
sorted
(
...
...
@@ -75,7 +75,7 @@ class U_EDF(Scheduler):
self
.
reschedule
()
def
update_al
(
self
):
delta
=
self
.
sim
.
now
()
-
self
.
last_event
delta
=
self
.
sim
.
now
-
self
.
last_event
for
job
,
j
in
self
.
running_jobs
.
items
():
self
.
al
[
job
][
j
]
-=
delta
...
...
@@ -89,7 +89,7 @@ class U_EDF(Scheduler):
else
:
self
.
update_al
()
self
.
last_event
=
self
.
sim
.
now
()
self
.
last_event
=
self
.
sim
.
now
next_event
=
None
decisions
=
[]
...
...
This diff is collapsed.
Click to expand it.
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