Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DCMTK only benchmark #639

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions pynetdicom/tests/benchmark_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,49 @@ def handle(event):
server.shutdown()


def receive_store_dcmtk(nr_assoc, ds_per_assoc, use_yappi=False):
"""Run a Storage SCP and transfer datasets with sequential storescu's.

Parameters
----------
nr_assoc : int
The total number of (sequential) associations that will be made.
ds_per_assoc : int
The number of C-STORE requests sent per successful association.
use_yappi : bool, optional
True to use the yappi profiler, False otherwise (default).
"""
if use_yappi:
init_yappi()

# Start SCP
server = start_storescp()
time.sleep(0.5)

start_time = time.time()
is_successful = True

for ii in range(nr_assoc):
p = start_storescu(ds_per_assoc)
# Block until transfer is complete
p.wait()
if p.returncode != 0:
is_successful = False
break

if is_successful:
print(
"C-STORE SCP transferred {} total datasets over {} "
"association(s) in {:.2f} s"
.format(nr_assoc * ds_per_assoc, nr_assoc, time.time() - start_time)
)
else:
print("C-STORE SCP benchmark failed")

server.terminate()



def receive_store_simultaneous(nr_assoc, ds_per_assoc, use_yappi=False):
"""Run a Storage SCP and transfer datasets with simultaneous storescu's.

Expand Down Expand Up @@ -412,6 +455,7 @@ def send_store(nr_assoc, ds_per_assoc, use_yappi=False):
print(" 7. Storage SCP, 1 dataset per association over 1000 associations")
print(" 8. Storage SCP, 1000 datasets per association over 10 simultaneous associations")
print(" 9. Storage SCU/SCP, 1000 datasets over 1 association")
print(" 10. Storage DCMTK SCU/SCP, 1000 datasets over 1 association")
bench_index = input()

if bench_index == "1":
Expand All @@ -432,3 +476,6 @@ def send_store(nr_assoc, ds_per_assoc, use_yappi=False):
receive_store_simultaneous(10, 1000, use_yappi)
elif bench_index == "9":
receive_store_internal(1, 1000, 0, use_yappi)
elif bench_index == "10":
receive_store_dcmtk(1, 1000, use_yappi)