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):
37 for (k, v) in params.items():
38 if s[k] != v: match = False
39 if not match: continue
41 ops = int(s['BENCH_OPS'])
43 vals = [x[ty][index] for x in r]
46 results[ops] = sum(vals) / len(vals)
50 if __name__ == '__main__':
51 for f in os.listdir('results'):
52 if f.endswith('.settings'):
53 data.append(load_results('results/' + f[:-len('.settings')]))
55 for size in [128, 512, 1024, 2048]:
56 params = {'BLUESKY_TARGET': 'native', 'BENCH_WRITERATIO': '1.0',
57 'BENCH_FILECOUNT': str(size / 4)}
59 d0 = extract(data, params, ty='write', index=0)
60 d1 = extract(data, params, ty='write', index=1)
62 fp = open('%s-%d-write.data' % (params['BLUESKY_TARGET'], size), 'w')
63 for k in sorted(d0.keys()):
64 fp.write("%d\t%f\t%f\n" % (k, d0[k], d1[k]))