blob: 587ff7af0c1ff25aed210f24a45345ac28399b60 (
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
|
#!/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
|