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
ab0cc5e1
authored
Nov 27, 2020
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seems to work with a few bugs
parent
930ac7c0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
17 deletions
+21
-17
simso/core/Job.py
+4
-3
simso/core/Model.py
+4
-4
simso/core/Processor.py
+4
-3
simso/core/Task.py
+4
-4
simso/core/Timer.py
+5
-3
No files found.
simso/core/Job.py
View file @
ab0cc5e1
...
...
@@ -6,7 +6,7 @@ from simso.core.JobEvent import JobEvent
from
math
import
ceil
class
Job
(
Process
)
:
class
Job
:
"""The Job class simulate the behavior of a real Job. This *should* only be
instantiated by a Task."""
...
...
@@ -28,7 +28,6 @@ class Job(Process):
:type etm: AbstractExecutionTimeModel
:type sim: Model
"""
Process
.
__init__
(
self
,
env
=
sim
,
generator
=
self
.
activate_job
())
self
.
_task
=
task
self
.
_pred
=
pred
self
.
instr_count
=
0
# Updated by the cache model.
...
...
@@ -53,7 +52,9 @@ class Job(Process):
self
.
processor_ok
=
self
.
_sim
.
event
()
self
.
context_ok
=
self
.
_sim
.
event
()
self
.
context_ok
.
succeed
()
self
.
context_ready
=
True
self
.
context_ready
=
True
self
.
process
=
self
.
_sim
.
process
(
self
.
activate_job
())
def
is_active
(
self
):
"""
...
...
simso/core/Model.py
View file @
ab0cc5e1
...
...
@@ -134,11 +134,11 @@ class Model(Environment):
self
.
scheduler
.
init
()
self
.
progress
.
start
()
for
cpu
in
self
.
_processors
:
self
.
process
(
cpu
.
run
())
#
for cpu in self._processors:
#
self.process(cpu.run())
for
task
in
self
.
_task_list
:
self
.
process
(
task
.
execute
())
#
for task in self._task_list:
#
self.process(task.execute())
try
:
self
.
run
(
until
=
self
.
_duration
)
...
...
simso/core/Processor.py
View file @
ab0cc5e1
...
...
@@ -34,7 +34,7 @@ class ProcInfo(object):
self
.
caches
.
append
(
cache
)
class
Processor
(
Process
)
:
class
Processor
:
"""
A processor is responsible of deciding whether the simulated processor
should execute a job or execute the scheduler. There is one instance of
...
...
@@ -54,7 +54,6 @@ class Processor(Process):
cls
.
_identifier
=
0
def
__init__
(
self
,
model
,
proc_info
):
Process
.
__init__
(
self
,
model
,
self
.
run
())
self
.
_model
=
model
self
.
_internal_id
=
Processor
.
_identifier
Processor
.
_identifier
+=
1
...
...
@@ -74,6 +73,7 @@ class Processor(Process):
self
.
timer_monitor
=
Monitor
(
env
=
model
,
name
=
"Monitor Timer"
+
proc_info
.
name
)
self
.
_speed
=
proc_info
.
speed
self
.
process
=
self
.
_model
.
process
(
self
.
run
())
def
resched
(
self
):
"""
...
...
@@ -169,7 +169,8 @@ class Processor(Process):
while
not
self
.
_evts
:
yield
self
.
_model
.
timeout
(
1
)
if
job
:
self
.
_model
.
interrupt
(
job
)
# self._model.interrupt(job)
# job.process.interrupt()
self
.
monitor
.
observe
(
ProcCxtSaveEvent
())
# overhead save context
yield
self
.
_model
.
timeout
(
self
.
cs_overhead
)
...
...
simso/core/Task.py
View file @
ab0cc5e1
...
...
@@ -107,7 +107,7 @@ class TaskInfo(object):
return
stack
class
GenericTask
(
Process
)
:
class
GenericTask
:
"""
Abstract class for Tasks. :class:`ATask` and :class:`PTask` inherits from
this class.
...
...
@@ -132,7 +132,6 @@ class GenericTask(Process):
:type sim: Model
:type task_info: TaskInfo
"""
Process
.
__init__
(
self
,
env
=
sim
,
generator
=
self
.
execute
())
self
.
name
=
task_info
.
name
self
.
_task_info
=
task_info
self
.
_monitor
=
Monitor
(
name
=
"Monitor"
+
self
.
name
+
"_states"
,
...
...
@@ -146,6 +145,7 @@ class GenericTask(Process):
self
.
_cpi_alone
=
{}
self
.
_jobs
=
[]
self
.
job
=
None
self
.
process
=
self
.
_sim
.
process
(
self
.
execute
())
def
execute
(
self
):
pass
...
...
@@ -340,7 +340,7 @@ class SporadicTask(GenericTask):
self
.
_init
()
for
ndate
in
self
.
list_activation_dates
:
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
-
self
.
_sim
.
now
)
self
.
create_job
()
...
...
@@ -360,7 +360,7 @@ class ProbabilisticTask(GenericTask):
self
.
_init
()
for
ndate
in
self
.
list_activation_dates
:
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
\
yield
self
.
_sim
.
timeout
(
int
(
ndate
*
self
.
_sim
.
cycles_per_ms
)
-
self
.
_sim
.
now
)
self
.
create_job
()
...
...
simso/core/Timer.py
View file @
ab0cc5e1
...
...
@@ -6,9 +6,8 @@ from simpy import Environment, Process, Interrupt
# TODO: allow the user to specify an overhead.
class
InstanceTimer
(
Process
)
:
class
InstanceTimer
:
def
__init__
(
self
,
timer
):
Process
.
__init__
(
self
,
env
=
timer
.
_sim
,
generator
=
self
.
run
())
self
.
_sim
=
timer
.
_sim
self
.
function
=
timer
.
function
self
.
args
=
timer
.
args
...
...
@@ -17,6 +16,7 @@ class InstanceTimer(Process):
self
.
cpu
=
timer
.
cpu
self
.
running
=
False
self
.
overhead
=
timer
.
overhead
self
.
process
=
self
.
_sim
.
process
(
self
.
run
())
def
call_handler
(
self
):
if
self
.
running
:
...
...
@@ -54,6 +54,7 @@ class Timer(object):
The delay is expressed in milliseconds by default but it can also be given
in cycles.
"""
def
__init__
(
self
,
sim
,
function
,
args
,
delay
,
one_shot
=
True
,
prior
=
False
,
cpu
=
None
,
in_ms
=
True
,
overhead
=
0
):
"""
...
...
@@ -95,7 +96,8 @@ class Timer(object):
Start the timer.
"""
self
.
instance
=
InstanceTimer
(
self
)
self
.
_sim
.
process
(
self
.
instance
.
run
())
# TODO: , self.prior what's with this?
# TODO: , self.prior what's with this?
self
.
_sim
.
process
(
self
.
instance
.
run
())
def
stop
(
self
):
"""
...
...
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