5 def load_results(prefix):
6 settings_file = open(prefix + ".settings")
7 results_file = open(prefix + ".results")
10 for l in settings_file:
13 (k, v) = l.split('=', 1)
19 for l in results_file:
21 if len(l) == 0 and len(result_group) > 0:
22 results.append(result_group)
24 m = re.match(r"^(\w+): \[(.*)\]$", l)
26 vals = [float(x.strip()) for x in m.group(2).split(',')]
27 result_group[m.group(1)] = vals
28 if len(result_group) > 0:
29 results.append(result_group)
31 return (settings, results)
33 def extract(data, params={}, ty='read', index=0):
35 ty = ('read', 'write')
42 for (k, v) in params.items():
43 if s[k] != v: match = False
44 if not match: continue
46 ops = int(s['BENCH_OPS'])
50 vals = [x[t][index] for x in r]
52 vs += sum(vals) / (len(vals) or 1)
58 if __name__ == '__main__':
60 for f in os.listdir(dirname):
61 if f.endswith('.settings'):
62 data.append(load_results(dirname + '/' + f[:-len('.settings')]))
64 ratios = {'read': '0.0', 'write': '1.0', 'mixed': '0.5'}
66 blocksizes = set(int(s[0]['BENCH_BLOCKSIZE'])
67 or int(s[0]['BENCH_FILESIZE'])
70 sizes = set(int(s[0]['BENCH_FILESIZE']) * int(s[0]['BENCH_FILECOUNT']) / 1024**2
74 for size in sorted(sizes):
75 for blocksize in sorted(blocksizes):
77 params = {'BLUESKY_TARGET': 's3:mvrable-bluesky-west',
78 'BENCH_WRITERATIO': ratios[ratio],
79 'BENCH_FILECOUNT': str(size),
80 'BENCH_BLOCKSIZE': str(blocksize)}
82 if blocksize < basesize:
83 params['BENCH_BLOCKSIZE'] = str(blocksize)
84 params['BENCH_FILESIZE'] = str(basesize)
85 elif blocksize >= basesize:
86 params['BENCH_BLOCKSIZE'] = str(0)
87 params['BENCH_FILESIZE'] = str(blocksize)
89 d0 = extract(data, params, ty=ratio, index=0)
90 d1 = extract(data, params, ty=ratio, index=1)
92 fp = open('%s-%d-%s-%dk.data' % (params['BLUESKY_TARGET'], size, ratio, blocksize / 1024), 'w')
93 for k in sorted(d0.keys()):
94 fp.write("%d\t%f\t%f\n" % (k, d0[k], d1[k]))