summaryrefslogtreecommitdiff
path: root/scripts/profiling/sync/profile-sync.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-04-25 21:08:11 -0400
committerKali Kaneko <kali@leap.se>2016-04-25 21:08:11 -0400
commitf660630ac6676dd31d4984f4df9e9110b548b746 (patch)
tree9f2be4650d852ea16b2fd3bfd108e5c376bfacbb /scripts/profiling/sync/profile-sync.py
parent40e32be29d9b02e03da4f007fb4f68f3e3709c01 (diff)
parentd5974f61df6ca640dde69903976d4721b6d88007 (diff)
Merge tag '0.8.0' into debian/experimental
Tag soledad version 0.8.0
Diffstat (limited to 'scripts/profiling/sync/profile-sync.py')
-rwxr-xr-xscripts/profiling/sync/profile-sync.py11
1 files changed, 8 insertions, 3 deletions
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
@@ -95,6 +97,9 @@ if __name__ == '__main__':
'--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')
parser.add_argument(