Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
cbd825e1
Commit
cbd825e1
authored
Jul 24, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Jul 29, 2022
Browse files
HostSim: pass node_config in __init__
parent
74a9f167
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+7
-13
No files found.
experiments/simbricks/simulators.py
View file @
cbd825e1
...
@@ -195,9 +195,9 @@ class NetSim(Simulator):
...
@@ -195,9 +195,9 @@ class NetSim(Simulator):
class
HostSim
(
Simulator
):
class
HostSim
(
Simulator
):
"""Base class for host simulators."""
"""Base class for host simulators."""
def
__init__
(
self
):
def
__init__
(
self
,
node_config
:
NodeConfig
):
super
().
__init__
()
super
().
__init__
()
self
.
node_config
:
tp
.
Optional
[
N
ode
C
onfig
]
=
None
self
.
node_config
=
n
ode
_c
onfig
"""Config for the simulated host. """
"""Config for the simulated host. """
self
.
name
=
''
self
.
name
=
''
self
.
wait
=
False
self
.
wait
=
False
...
@@ -229,9 +229,6 @@ class HostSim(Simulator):
...
@@ -229,9 +229,6 @@ class HostSim(Simulator):
net
.
hosts_direct
.
append
(
self
)
net
.
hosts_direct
.
append
(
self
)
self
.
net_directs
.
append
(
net
)
self
.
net_directs
.
append
(
net
)
def
set_config
(
self
,
nc
:
NodeConfig
):
self
.
node_config
=
nc
def
dependencies
(
self
):
def
dependencies
(
self
):
deps
=
[]
deps
=
[]
for
dev
in
self
.
pcidevs
:
for
dev
in
self
.
pcidevs
:
...
@@ -247,8 +244,8 @@ class HostSim(Simulator):
...
@@ -247,8 +244,8 @@ class HostSim(Simulator):
class
QemuHost
(
HostSim
):
class
QemuHost
(
HostSim
):
"""Qemu host simulator."""
"""Qemu host simulator."""
def
__init__
(
self
):
def
__init__
(
self
,
node_config
:
NodeConfig
):
super
().
__init__
()
super
().
__init__
(
node_config
)
self
.
sync
=
False
self
.
sync
=
False
self
.
cpu_freq
=
'4GHz'
self
.
cpu_freq
=
'4GHz'
...
@@ -314,8 +311,9 @@ class QemuHost(HostSim):
...
@@ -314,8 +311,9 @@ class QemuHost(HostSim):
class
Gem5Host
(
HostSim
):
class
Gem5Host
(
HostSim
):
"""Gem5 host simulator."""
"""Gem5 host simulator."""
def
__init__
(
self
):
def
__init__
(
self
,
node_config
:
NodeConfig
):
super
().
__init__
()
node_config
.
sim
=
'gem5'
super
().
__init__
(
node_config
)
self
.
cpu_type_cp
=
'X86KvmCPU'
self
.
cpu_type_cp
=
'X86KvmCPU'
self
.
cpu_type
=
'TimingSimpleCPU'
self
.
cpu_type
=
'TimingSimpleCPU'
self
.
sys_clock
=
'1GHz'
self
.
sys_clock
=
'1GHz'
...
@@ -323,10 +321,6 @@ class Gem5Host(HostSim):
...
@@ -323,10 +321,6 @@ class Gem5Host(HostSim):
self
.
extra_config_args
=
[]
self
.
extra_config_args
=
[]
self
.
variant
=
'fast'
self
.
variant
=
'fast'
def
set_config
(
self
,
nc
):
nc
.
sim
=
'gem5'
super
().
set_config
(
nc
)
def
resreq_cores
(
self
):
def
resreq_cores
(
self
):
return
1
return
1
...
...
Prev
1
2
Next
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