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
f6669016
Commit
f6669016
authored
Nov 30, 2020
by
Jialin Li
Browse files
experiments: add sync_mode option
parent
5728d26c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
experiments/modes/simulators.py
experiments/modes/simulators.py
+9
-7
No files found.
experiments/modes/simulators.py
View file @
f6669016
...
@@ -42,6 +42,7 @@ class NICSim(Simulator):
...
@@ -42,6 +42,7 @@ class NICSim(Simulator):
network
=
None
network
=
None
name
=
''
name
=
''
sync_mode
=
0
sync_period
=
500
sync_period
=
500
pci_latency
=
500
pci_latency
=
500
eth_latency
=
500
eth_latency
=
500
...
@@ -51,10 +52,10 @@ class NICSim(Simulator):
...
@@ -51,10 +52,10 @@ class NICSim(Simulator):
net
.
nics
.
append
(
self
)
net
.
nics
.
append
(
self
)
def
basic_run_cmd
(
self
,
env
,
name
,
extra
=
None
):
def
basic_run_cmd
(
self
,
env
,
name
,
extra
=
None
):
cmd
=
'%s/%s %s %s %s 0 %d %d %d'
%
\
cmd
=
'%s/%s %s %s %s
%d
0 %d %d %d'
%
\
(
env
.
repodir
,
name
,
env
.
nic_pci_path
(
self
),
env
.
nic_eth_path
(
self
),
(
env
.
repodir
,
name
,
env
.
nic_pci_path
(
self
),
env
.
nic_eth_path
(
self
),
env
.
nic_shm_path
(
self
),
self
.
sync_
peri
od
,
self
.
pci_latency
,
env
.
nic_shm_path
(
self
),
self
.
sync_
m
od
e
,
self
.
sync_period
,
self
.
eth_latency
)
self
.
pci_latency
,
self
.
eth_latency
)
if
extra
is
not
None
:
if
extra
is
not
None
:
cmd
+=
' '
+
extra
cmd
+=
' '
+
extra
...
@@ -66,6 +67,7 @@ class NICSim(Simulator):
...
@@ -66,6 +67,7 @@ class NICSim(Simulator):
class
NetSim
(
Simulator
):
class
NetSim
(
Simulator
):
name
=
''
name
=
''
opt
=
''
opt
=
''
sync_mode
=
0
sync_period
=
500
sync_period
=
500
eth_latency
=
500
eth_latency
=
500
...
@@ -211,15 +213,15 @@ class I40eNIC(NICSim):
...
@@ -211,15 +213,15 @@ class I40eNIC(NICSim):
class
WireNet
(
NetSim
):
class
WireNet
(
NetSim
):
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
assert
len
(
self
.
nics
)
==
2
assert
len
(
self
.
nics
)
==
2
return
'%s/net_wire/net_wire %s %s %d %d'
%
\
return
'%s/net_wire/net_wire %s %s %d
%d
%d'
%
\
(
env
.
repodir
,
env
.
nic_eth_path
(
self
.
nics
[
0
]),
(
env
.
repodir
,
env
.
nic_eth_path
(
self
.
nics
[
0
]),
env
.
nic_eth_path
(
self
.
nics
[
1
]),
env
.
nic_eth_path
(
self
.
nics
[
1
]),
self
.
sync_period
,
self
.
eth_latency
)
self
.
sync_mode
,
self
.
sync_period
,
self
.
eth_latency
)
class
SwitchNet
(
NetSim
):
class
SwitchNet
(
NetSim
):
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
env
.
repodir
+
'/net_switch/net_switch'
cmd
=
env
.
repodir
+
'/net_switch/net_switch'
cmd
+=
f
' -S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
'
cmd
+=
f
'
-m
{
self
.
sync_mode
}
-S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
'
for
n
in
self
.
nics
:
for
n
in
self
.
nics
:
cmd
+=
' -s '
+
env
.
nic_eth_path
(
n
)
cmd
+=
' -s '
+
env
.
nic_eth_path
(
n
)
return
cmd
return
cmd
...
@@ -315,4 +317,4 @@ def create_dctcp_hosts(e, num, name_prefix, net, nic_class, host_class,
...
@@ -315,4 +317,4 @@ def create_dctcp_hosts(e, num, name_prefix, net, nic_class, host_class,
hosts
.
append
(
host
)
hosts
.
append
(
host
)
return
hosts
return
hosts
\ No newline at end of file
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