Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
3e6125f6
Commit
3e6125f6
authored
Aug 11, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix various problems. properly check status of children
parent
6415368f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
9 deletions
+45
-9
benchmarks/linear-raw-thorughput.py
benchmarks/linear-raw-thorughput.py
+45
-9
No files found.
benchmarks/linear-raw-thorughput.py
View file @
3e6125f6
#!/usr/bin/env python
# vim: ts=4:sw=4:et:ai:sts=4
import
getopt
,
netns
,
os
.
path
,
re
,
sys
import
getopt
,
netns
,
os
,
os
.
path
,
re
,
select
,
subprocess
,
sys
__doc__
=
"""Creates a linear network topology, and measures the maximum
end-to-end throughput for the specified packet size."""
...
...
@@ -34,7 +34,7 @@ def main():
except
getopt
.
GetoptError
,
err
:
error
=
str
(
err
)
# opts will be empty
pktsize
=
nr
=
time
=
packets
=
bytes
=
None
pktsize
=
nr
=
time
=
packets
=
n
bytes
=
None
use_p2p
=
False
delay
=
jitter
=
bandwidth
=
None
...
...
@@ -51,7 +51,7 @@ def main():
elif
o
in
(
"-p"
,
"--packets"
):
packets
=
int
(
a
)
elif
o
in
(
"--bytes"
):
bytes
=
int
(
a
)
n
bytes
=
int
(
a
)
elif
o
in
(
"--delay"
):
delay
=
float
(
a
)
elif
o
in
(
"--jitter"
):
...
...
@@ -82,17 +82,53 @@ def main():
usage
(
sys
.
stderr
)
sys
.
exit
(
2
)
if
not
(
time
or
bytes
or
packets
):
if
not
(
time
or
n
bytes
or
packets
):
time
=
10
udp_perf
=
netns
.
environ
.
find_bin
(
"udp-perf"
,
extra_path
=
[
"."
,
os
.
path
.
dirname
(
sys
.
argv
[
0
])])
if
not
udp_perf
:
raise
RuntimeError
(
"Cannot find `udp-perf'"
)
nodes
,
interfaces
,
links
=
create_topo
(
nr
,
use_p2p
,
delay
,
jitter
,
bandwidth
)
#nodes[0].system("ping -c 30 -i 1.2 -w 60 -s 1400 %s" % dec2ip(ip2dec("10.0.0.2") + 4 * (nr - 2)))
p
=
nodes
[
0
].
Popen
([
"iperf"
,
"-s"
,
"-u"
])
nodes
[
nr
-
1
].
system
(
"iperf -c 10.0.0.1 -u -b 10000M"
)
p
.
signal
()
p
.
wait
()
cmdline
=
[
udp_perf
,
"--server"
]
if
time
:
cmdline
.
append
(
"--max-time=%d"
%
time
)
if
packets
:
cmdline
.
append
(
"--max-pkts=%d"
%
packets
)
if
nbytes
:
cmdline
.
append
(
"--max-bytes=%d"
%
nbytes
)
srv
=
nodes
[
0
].
Popen
(
cmdline
,
stdout
=
subprocess
.
PIPE
)
cmdline
=
[
udp_perf
,
"--client"
,
"--pktsize=%d"
%
pktsize
]
if
nr
>
1
:
cmdline
.
append
(
"--host=10.0.0.1"
)
clt
=
nodes
[
nr
-
1
].
Popen
(
cmdline
)
out
=
""
while
(
True
):
ready
=
select
.
select
([
srv
.
stdout
],
[],
[],
0.1
)[
0
]
if
ready
:
r
=
os
.
read
(
srv
.
stdout
.
fileno
(),
1024
)
if
not
r
:
break
out
+=
r
if
srv
.
poll
()
!=
None
or
clt
.
poll
()
!=
None
:
break
if
srv
.
poll
():
raise
RuntimeError
(
"upd-perf server returned with error."
)
if
clt
.
poll
():
raise
RuntimeError
(
"upd-perf client returned with error."
)
srv
.
wait
()
clt
.
wait
()
print
out
.
strip
()
def
ip2dec
(
ip
):
match
=
re
.
search
(
r'^(\
d+)
\.(\
d+)
\.(\
d+)
\.(\
d+)$
', ip)
...
...
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