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
963dd677
Commit
963dd677
authored
Jun 3, 2016
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
benchmark: don't block while putting values
parent
54a43270
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/tools/dht/tests.py
+13
-10
13 additions, 10 deletions
python/tools/dht/tests.py
with
13 additions
and
10 deletions
python/tools/dht/tests.py
+
13
−
10
View file @
963dd677
...
@@ -208,13 +208,13 @@ class DhtFeatureTest(FeatureTest):
...
@@ -208,13 +208,13 @@ class DhtFeatureTest(FeatureTest):
FeatureTest
.
lock
.
notify
()
FeatureTest
.
lock
.
notify
()
def
_dhtPut
(
self
,
producer
,
_hash
,
*
values
):
def
_dhtPut
(
self
,
producer
,
_hash
,
*
values
):
for
val
in
values
:
with
FeatureTest
.
lock
:
with
FeatureTest
.
lock
:
for
val
in
values
:
vstr
=
val
.
__str__
()[:
100
]
vstr
=
val
.
__str__
()[:
100
]
DhtNetwork
.
log
(
'
[PUT]:
'
,
_hash
.
toString
(),
'
->
'
,
vstr
+
(
"
...
"
if
len
(
vstr
)
>
100
else
""
))
DhtNetwork
.
log
(
'
[PUT]:
'
,
_hash
.
toString
(),
'
->
'
,
vstr
+
(
"
...
"
if
len
(
vstr
)
>
100
else
""
))
FeatureTest
.
done
+=
1
FeatureTest
.
done
+=
1
while
FeatureTest
.
done
>
0
:
producer
.
put
(
_hash
,
val
,
DhtFeatureTest
.
putDoneCb
)
producer
.
put
(
_hash
,
val
,
DhtFeatureTest
.
putDoneCb
)
while
FeatureTest
.
done
>
0
:
FeatureTest
.
lock
.
wait
()
FeatureTest
.
lock
.
wait
()
def
_dhtGet
(
self
,
consumer
,
_hash
):
def
_dhtGet
(
self
,
consumer
,
_hash
):
...
@@ -222,9 +222,9 @@ class DhtFeatureTest(FeatureTest):
...
@@ -222,9 +222,9 @@ class DhtFeatureTest(FeatureTest):
DhtFeatureTest
.
foreignNodes
=
[]
DhtFeatureTest
.
foreignNodes
=
[]
with
FeatureTest
.
lock
:
with
FeatureTest
.
lock
:
FeatureTest
.
done
+=
1
FeatureTest
.
done
+=
1
while
FeatureTest
.
done
>
0
:
DhtNetwork
.
log
(
'
[GET]:
'
,
_hash
.
toString
())
DhtNetwork
.
log
(
'
[GET]:
'
,
_hash
.
toString
())
consumer
.
get
(
_hash
,
DhtFeatureTest
.
getcb
,
DhtFeatureTest
.
getDoneCb
)
consumer
.
get
(
_hash
,
DhtFeatureTest
.
getcb
,
DhtFeatureTest
.
getDoneCb
)
while
FeatureTest
.
done
>
0
:
FeatureTest
.
lock
.
wait
()
FeatureTest
.
lock
.
wait
()
def
_gottaGetThemAllPokeNodes
(
self
,
consumer
,
hashes
,
nodes
=
None
):
def
_gottaGetThemAllPokeNodes
(
self
,
consumer
,
hashes
,
nodes
=
None
):
...
@@ -356,7 +356,7 @@ class PersistenceTest(DhtFeatureTest):
...
@@ -356,7 +356,7 @@ class PersistenceTest(DhtFeatureTest):
bootstrap
=
self
.
bootstrap
bootstrap
=
self
.
bootstrap
# Value representing an ICE packet. Each ICE packet is around 1KB.
# Value representing an ICE packet. Each ICE packet is around 1KB.
VALUE_SIZE
=
1024
VALUE_SIZE
=
1024
NUM_VALUES
=
self
.
_num_values
/
wb
.
node_num
if
self
.
_num_values
else
5
0
NUM_VALUES
=
self
.
_num_values
/
wb
.
node_num
if
self
.
_num_values
else
5
nr_values
=
NUM_VALUES
*
wb
.
node_num
nr_values
=
NUM_VALUES
*
wb
.
node_num
nr_nodes
=
wb
.
node_num
nr_nodes
=
wb
.
node_num
nr_nodes_cv
=
threading
.
Condition
()
nr_nodes_cv
=
threading
.
Condition
()
...
@@ -365,8 +365,11 @@ class PersistenceTest(DhtFeatureTest):
...
@@ -365,8 +365,11 @@ class PersistenceTest(DhtFeatureTest):
hashes
=
[
random_hash
()
for
_
in
range
(
wb
.
node_num
)]
hashes
=
[
random_hash
()
for
_
in
range
(
wb
.
node_num
)]
# initial set of values
# initial set of values
i
=
0
for
h
in
hashes
:
for
h
in
hashes
:
self
.
_dhtPut
(
bootstrap
.
front
(),
h
,
*
[
Value
(
v
)
for
v
in
values
])
self
.
_dhtPut
(
bootstrap
.
front
(),
h
,
*
[
Value
(
v
)
for
v
in
values
])
print
(
"
at:
"
,
i
)
i
+=
1
def
normalBehavior
(
do
,
t
,
log
=
None
):
def
normalBehavior
(
do
,
t
,
log
=
None
):
nonlocal
nr_values
nonlocal
nr_values
...
...
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