Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
4622a828
Commit
4622a828
authored
May 15, 2016
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
benchmark/get: improve ploting
parent
bd72c646
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/tools/dht/network.py
+4
-6
4 additions, 6 deletions
python/tools/dht/network.py
python/tools/dht/tests.py
+9
-6
9 additions, 6 deletions
python/tools/dht/tests.py
with
13 additions
and
12 deletions
python/tools/dht/network.py
+
4
−
6
View file @
4622a828
...
@@ -273,13 +273,11 @@ class DhtNetwork(object):
...
@@ -273,13 +273,11 @@ class DhtNetwork(object):
@staticmethod
@staticmethod
def
run_node
(
ip4
,
ip6
,
p
,
bootstrap
=
[],
is_bootstrap
=
False
):
def
run_node
(
ip4
,
ip6
,
p
,
bootstrap
=
[],
is_bootstrap
=
False
):
DhtNetwork
.
log
(
"
run_node
"
,
ip4
,
ip6
,
p
,
bootstrap
)
DhtNetwork
.
log
(
"
run_node
"
,
ip4
,
ip6
,
p
,
bootstrap
)
id
=
Identity
()
#id.generate("dhtbench"+str(p), Identity(), 1024)
n
=
DhtRunner
()
n
=
DhtRunner
()
n
.
run
(
id
,
ipv4
=
ip4
if
ip4
else
""
,
ipv6
=
ip6
if
ip6
else
""
,
port
=
p
,
is_bootstrap
=
is_bootstrap
)
n
.
run
(
ipv4
=
ip4
if
ip4
else
""
,
ipv6
=
ip6
if
ip6
else
""
,
port
=
p
,
is_bootstrap
=
is_bootstrap
)
for
b
in
bootstrap
:
for
b
in
bootstrap
:
n
.
bootstrap
(
b
[
0
],
b
[
1
])
n
.
bootstrap
(
b
[
0
],
b
[
1
])
#plt.pause(0
.0
2
)
time
.
sleep
(
.
0
1
)
return
((
ip4
,
ip6
,
p
),
n
,
id
)
return
((
ip4
,
ip6
,
p
),
n
,
id
)
@staticmethod
@staticmethod
...
@@ -387,11 +385,11 @@ class DhtNetwork(object):
...
@@ -387,11 +385,11 @@ class DhtNetwork(object):
if
n
==
l
:
if
n
==
l
:
return
return
if
n
>
l
:
if
n
>
l
:
DhtNetwork
.
log
(
"
Launching
"
,
n
-
l
,
"
nodes
"
)
DhtNetwork
.
log
(
"
Launching
"
,
n
-
l
,
"
nodes
"
,
self
.
ip4
,
self
.
ip6
)
for
i
in
range
(
l
,
n
):
for
i
in
range
(
l
,
n
):
self
.
launch_node
()
self
.
launch_node
()
else
:
else
:
DhtNetwork
.
log
(
"
Ending
"
,
l
-
n
,
"
nodes
"
)
DhtNetwork
.
log
(
"
Ending
"
,
l
-
n
,
"
nodes
"
,
self
.
ip4
,
self
.
ip6
)
#random.shuffle(self.nodes)
#random.shuffle(self.nodes)
for
i
in
range
(
n
,
l
):
for
i
in
range
(
n
,
l
):
self
.
end_node
()
self
.
end_node
()
...
...
This diff is collapsed.
Click to expand it.
python/tools/dht/tests.py
+
9
−
6
View file @
4622a828
...
@@ -636,7 +636,7 @@ class PerformanceTest(DhtFeatureTest):
...
@@ -636,7 +636,7 @@ class PerformanceTest(DhtFeatureTest):
hax
.
set_ylim
(
0
,
2
)
hax
.
set_ylim
(
0
,
2
)
# let the network stabilise
# let the network stabilise
plt
.
pause
(
6
0
)
plt
.
pause
(
2
0
)
#start = time.time()
#start = time.time()
times
=
[]
times
=
[]
...
@@ -649,7 +649,7 @@ class PerformanceTest(DhtFeatureTest):
...
@@ -649,7 +649,7 @@ class PerformanceTest(DhtFeatureTest):
DhtNetwork
.
log
(
"
found
"
,
v
)
DhtNetwork
.
log
(
"
found
"
,
v
)
return
True
return
True
def
donecb
(
ok
,
nodes
):
def
donecb
(
ok
,
nodes
,
start
):
nonlocal
bootstrap
,
lock
,
done
,
times
nonlocal
bootstrap
,
lock
,
done
,
times
t
=
time
.
time
()
-
start
t
=
time
.
time
()
-
start
with
lock
:
with
lock
:
...
@@ -665,7 +665,10 @@ class PerformanceTest(DhtFeatureTest):
...
@@ -665,7 +665,10 @@ class PerformanceTest(DhtFeatureTest):
l
=
lines
.
pop
()
l
=
lines
.
pop
()
l
.
remove
()
l
.
remove
()
del
l
del
l
lines
=
plt
.
plot
(
times
,
color
=
'
blue
'
)
if
len
(
times
)
>
1
:
n
,
bins
,
lines
=
hax
.
hist
(
times
,
100
,
normed
=
1
,
histtype
=
'
stepfilled
'
,
color
=
'
g
'
)
hax
.
set_ylim
(
min
(
n
),
max
(
n
))
lines
.
extend
(
lax
.
plot
(
times
,
color
=
'
blue
'
))
plt
.
draw
()
plt
.
draw
()
def
run_get
():
def
run_get
():
...
@@ -686,12 +689,12 @@ class PerformanceTest(DhtFeatureTest):
...
@@ -686,12 +689,12 @@ class PerformanceTest(DhtFeatureTest):
DhtNetwork
.
log
(
"
Getting 50 random hashes succesively.
"
)
DhtNetwork
.
log
(
"
Getting 50 random hashes succesively.
"
)
for
i
in
range
(
50
):
for
i
in
range
(
50
):
with
lock
:
with
lock
:
done
+=
1
for
_
in
range
(
1
):
start
=
time
.
time
()
run_get
()
bootstrap
.
front
().
get
(
InfoHash
.
getRandom
(),
getcb
,
donecb
)
while
done
>
0
:
while
done
>
0
:
lock
.
wait
()
lock
.
wait
()
update_plot
()
update_plot
()
plt
.
pause
(.
1
)
update_plot
()
update_plot
()
print
(
"
Took
"
,
np
.
sum
(
times
),
"
mean
"
,
np
.
mean
(
times
),
"
std
"
,
np
.
std
(
times
),
"
min
"
,
np
.
min
(
times
),
"
max
"
,
np
.
max
(
times
))
print
(
"
Took
"
,
np
.
sum
(
times
),
"
mean
"
,
np
.
mean
(
times
),
"
std
"
,
np
.
std
(
times
),
"
min
"
,
np
.
min
(
times
),
"
max
"
,
np
.
max
(
times
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment