summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2016-05-01 23:02:04 -0300
committerdrebs <drebs@riseup.net>2016-05-02 20:43:28 -0300
commit9c1dc66c057dee764e80af875cb60a75e8e3aca4 (patch)
tree6870ab7c22a4f9642dc6860df42c100d9dd391d0
parent1de2723fdd05dc2c404d9bb7213dd7b93d0c50f6 (diff)
dump sync stats to file
-rw-r--r--Makefile4
-rw-r--r--measure-perf-series.py2
-rw-r--r--soledad_sync.py12
3 files changed, 14 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index c710c68..f9da7d2 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,8 @@ measure-series:
# TODO measure, first of all, the number of seconds from the beginning!!! (right now it's biased)
# TODO add cpu/ram usage (ping command COULD RETURN THAT!)
rm -f /tmp/soledadsync/*
- rm -f series.log
+ rm -f ./out/series.log
python measure-perf-series.py
graph-series:
- data=series.log ./graphit
+ data=./out/series.log ./graphit
diff --git a/measure-perf-series.py b/measure-perf-series.py
index 5694bc8..e87fcac 100644
--- a/measure-perf-series.py
+++ b/measure-perf-series.py
@@ -6,7 +6,7 @@ import datetime
# you have significant variability in there.
POINTS = 200
-commands.getoutput('echo time req/s cpu mem phase > series.log')
+commands.getoutput('echo time req/s cpu mem phase > ./out/series.log')
start = datetime.datetime.now()
for i in range(POINTS):
diff --git a/soledad_sync.py b/soledad_sync.py
index e291d68..e53f49c 100644
--- a/soledad_sync.py
+++ b/soledad_sync.py
@@ -1,4 +1,5 @@
import os
+import json
from ConfigParser import ConfigParser
from leap.soledad.client.api import Soledad
from twisted.internet import defer
@@ -11,6 +12,8 @@ HOST = parser.get('server', 'host')
UUID = parser.get('client', 'uuid')
NUM_DOCS = int(parser.get('sync', 'num_docs'))
PAYLOAD = parser.get('sync', 'payload')
+AUTH_TOKEN = parser.get('sync', 'auth-token')
+STATS_FILE = parser.get('test', 'stats-file')
@@ -20,6 +23,7 @@ DO_THESEUS = os.environ.get('THESEUS', False)
phase = 0
+
def _get_soledad_instance_from_uuid(uuid, passphrase, basedir, server_url,
cert_file, token):
secrets_path = os.path.join(basedir, '%s.secret' % uuid)
@@ -55,7 +59,12 @@ def upload_soledad_stuff():
t.install()
s = _get_soledad_instance_from_uuid(
- UUID, 'pass', '/tmp/soledadsync', HOST, '', 'an-auth-token')
+ UUID, 'pass', '/tmp/soledadsync', HOST, '', AUTH_TOKEN)
+
+ def dumpStats(_):
+ stats = s.sync_stats()
+ with open(STATS_FILE, 'w') as f:
+ f.write(json.dumps(stats))
def do_sync(_):
global phase
@@ -63,6 +72,7 @@ def upload_soledad_stuff():
phase += 1
d = s.sync()
d.addCallback(onSyncDone)
+ d.addCallback(dumpStats)
return d
def stop_tracing(_):