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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
963dd677
Commit
963dd677
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
benchmark: don't block while putting values
parent
54a43270
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide 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,23 +208,23 @@ class DhtFeatureTest(FeatureTest):
FeatureTest
.
lock
.
notify
()
def
_dhtPut
(
self
,
producer
,
_hash
,
*
values
):
for
val
in
values
:
with
FeatureTest
.
lock
:
vstr
=
val
.
__str__
()[:
100
]
DhtNetwork
.
log
(
'
[PUT]:
'
,
_hash
.
toString
(),
'
->
'
,
vstr
+
(
"
...
"
if
len
(
vstr
)
>
100
else
""
))
FeatureTest
.
done
+=
1
while
FeatureTest
.
done
>
0
:
with
FeatureTest
.
lock
:
for
val
in
values
:
vstr
=
val
.
__str__
()[:
100
]
DhtNetwork
.
log
(
'
[PUT]:
'
,
_hash
.
toString
(),
'
->
'
,
vstr
+
(
"
...
"
if
len
(
vstr
)
>
100
else
""
))
FeatureTest
.
done
+=
1
producer
.
put
(
_hash
,
val
,
DhtFeatureTest
.
putDoneCb
)
FeatureTest
.
lock
.
wait
()
while
FeatureTest
.
done
>
0
:
FeatureTest
.
lock
.
wait
()
def
_dhtGet
(
self
,
consumer
,
_hash
):
DhtFeatureTest
.
foreignValues
=
[]
DhtFeatureTest
.
foreignNodes
=
[]
with
FeatureTest
.
lock
:
FeatureTest
.
done
+=
1
DhtNetwork
.
log
(
'
[GET]:
'
,
_hash
.
toString
())
consumer
.
get
(
_hash
,
DhtFeatureTest
.
getcb
,
DhtFeatureTest
.
getDoneCb
)
while
FeatureTest
.
done
>
0
:
DhtNetwork
.
log
(
'
[GET]:
'
,
_hash
.
toString
())
consumer
.
get
(
_hash
,
DhtFeatureTest
.
getcb
,
DhtFeatureTest
.
getDoneCb
)
FeatureTest
.
lock
.
wait
()
def
_gottaGetThemAllPokeNodes
(
self
,
consumer
,
hashes
,
nodes
=
None
):
...
...
@@ -356,7 +356,7 @@ class PersistenceTest(DhtFeatureTest):
bootstrap
=
self
.
bootstrap
# Value representing an ICE packet. Each ICE packet is around 1KB.
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_nodes
=
wb
.
node_num
nr_nodes_cv
=
threading
.
Condition
()
...
...
@@ -365,8 +365,11 @@ class PersistenceTest(DhtFeatureTest):
hashes
=
[
random_hash
()
for
_
in
range
(
wb
.
node_num
)]
# initial set of values
i
=
0
for
h
in
hashes
:
self
.
_dhtPut
(
bootstrap
.
front
(),
h
,
*
[
Value
(
v
)
for
v
in
values
])
print
(
"
at:
"
,
i
)
i
+=
1
def
normalBehavior
(
do
,
t
,
log
=
None
):
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