From 46678a7aecb98dbdc20846477c7f5110f3c63861 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 17 Nov 2015 12:54:25 -0400 Subject: [feat] add script to measure batch of uploads - Releases: 0.8.0 --- scripts/profiling/sync/profile-sync.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts/profiling/sync/profile-sync.py') diff --git a/scripts/profiling/sync/profile-sync.py b/scripts/profiling/sync/profile-sync.py index 9ef2ea92..8c18bde8 100755 --- a/scripts/profiling/sync/profile-sync.py +++ b/scripts/profiling/sync/profile-sync.py @@ -57,15 +57,17 @@ def create_docs(soledad, args): bail('--payload-file does not exist!') return - numdocs = args.send_num - docsize = args.send_size + numdocs = int(args.send_num) + docsize = int(args.send_size) # XXX this will FAIL if the payload source is smaller to size * num # XXX could use a cycle iterator with open(sample_path, "r+b") as sample_f: fmap = mmap.mmap(sample_f.fileno(), 0, prot=mmap.PROT_READ) + payload = fmap.read(docsize * 1024) for index in xrange(numdocs): - payload = fmap.read(docsize * 1024) + if not args.repeat_payload: + payload = fmap.read(docsize * 1024) s.create_doc({payload: payload}) # main program @@ -94,6 +96,9 @@ if __name__ == '__main__': parser.add_argument( '--send-num', dest='send_num', default=10, help='number of docs to send (default: 10)') + parser.add_argument( + '--repeat-payload', dest='repeat_payload', action='store_true', + default=False) parser.add_argument( '--payload-file', dest="payload_f", default=None, help='path to a sample file to use for the payloads') -- cgit v1.2.3