diff options
Diffstat (limited to 'client-responsiveness/scripts/measure_perf_series.py')
-rwxr-xr-x | client-responsiveness/scripts/measure_perf_series.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client-responsiveness/scripts/measure_perf_series.py b/client-responsiveness/scripts/measure_perf_series.py new file mode 100755 index 0000000..587ff7a --- /dev/null +++ b/client-responsiveness/scripts/measure_perf_series.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import commands +import datetime + +# How many points to measure. Make sure that you leave the baseline +# running for a significative amount before triggering the sync, it's possible +# you have significant variability in there. +POINTS = 400 + +SCALE = 50 + +commands.getoutput('echo time req/s cpu mem sync_phase sync_exchange_phase > ./out/series.log') +start = datetime.datetime.now() + +for i in range(POINTS): + value = commands.getoutput('./scripts/get_ping_rate.py') + print "Step", i, "...", value + stats = commands.getoutput('./scripts/get_client_stats.py') + cpu, mem, sync_phase, sync_exchange_phase = stats.split() + sync_phase = str(int(sync_phase)*SCALE) + sync_exchange_phase = str(int(sync_exchange_phase)*SCALE) + now = datetime.datetime.now() + secs = (now - start).total_seconds() + try: + # make it so the script exits succesfully when the server is dead + commands.getoutput( + 'echo %s\t%s\t%s\t%s\t%s\t%s >> ./out/series.log' \ + % (secs, value, cpu, mem, sync_phase, sync_exchange_phase)) + except ValueError: + break |