diff options
author | Kali Kaneko <kali@leap.se> | 2015-11-17 12:54:25 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-11-17 12:56:26 -0400 |
commit | 46678a7aecb98dbdc20846477c7f5110f3c63861 (patch) | |
tree | 6d33b00719b8bf85d92a43fd6ca0ac11dffc0eb0 /scripts/profiling/sync/profile-sync.py | |
parent | 3aea1652d82755affdcf4c734f9f0ba004482046 (diff) |
[feat] add script to measure batch of uploads
- Releases: 0.8.0
Diffstat (limited to 'scripts/profiling/sync/profile-sync.py')
-rwxr-xr-x | scripts/profiling/sync/profile-sync.py | 11 |
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( |