blob: d371bb1afe8410caab69ced255ff80c5e772b4bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# benchmark_uploads.py
# Copyright (C) 2015 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Run benchmarks for sync (uploads).
"""
import getpass
import sys
import datetime
import subprocess
NUM_ITER = 10
NUM_UPLOADS = 10
RESULTS = []
if __name__ == "__main__":
user = sys.argv[1]
passwd = sys.argv[2]
opts = ("--no-stats --send-num %s --payload-file sample --repeat-payload -p "
"%s -b /tmp/profile-soledad-upload ") % (NUM_UPLOADS, passwd)
for i in xrange(NUM_ITER):
print "[+] ITERATION NUMBER: ", i
start = datetime.datetime.now()
cmd = "./profile-sync.py " + opts + user
print "CALLING", cmd
result = subprocess.check_call(cmd.split())
print "EXIT CODE:", result
end = datetime.datetime.now()
delta = (end - start)
RESULTS.append(delta)
print "[+] SYNC TOOK %s seconds" % delta.seconds
import numpy
res = [x.seconds for x in RESULTS]
print "-------------------------"
print "SYNC UPLOAD REPORT"
print "USER:", user
print "UPLOADS: %s 1K DOCS" % NUM_UPLOADS
print "ITERATIONS: %s" % NUM_ITER
print
print "mean :", numpy.mean(res)
print "stdev:", numpy.std(res)
print "-------------------------"
|