+#!/usr/bin/python2
+
+import os, re
+
+def load_results(prefix):
+ settings_file = open(prefix + ".settings")
+ results_file = open(prefix + ".results")
+
+ settings = {}
+ for l in settings_file:
+ l = l.strip()
+ try:
+ (k, v) = l.split('=', 1)
+ settings[k] = v
+ except: pass
+
+ results = []
+ result_group = {}
+ for l in results_file:
+ l = l.strip()
+ if len(l) == 0 and len(result_group) > 0:
+ results.append(result_group)
+ result_group = {}
+ m = re.match(r"^(\w+): \[(.*)\]$", l)
+ if m:
+ vals = [float(x.strip()) for x in m.group(2).split(',')]
+ result_group[m.group(1)] = vals
+ if len(result_group) > 0:
+ results.append(result_group)
+
+ return (settings, results)
+
+def extract(data, params={}, ty='read', index=0):
+ results = {}
+ for (s, r) in data:
+ match = True
+ for (k, v) in params.items():
+ if s[k] != v: match = False
+ if not match: continue
+
+ ops = int(s['BENCH_OPS'])
+
+ vals = [x[ty][index] for x in r]
+ vals = vals[5:]
+
+ results[ops] = sum(vals) / len(vals)
+ return results
+
+data = []
+if __name__ == '__main__':
+ for f in os.listdir('results'):
+ if f.endswith('.settings'):
+ data.append(load_results('results/' + f[:-len('.settings')]))
+
+for size in [128, 512, 1024, 2048]:
+ params = {'BLUESKY_TARGET': 'native', 'BENCH_WRITERATIO': '1.0',
+ 'BENCH_FILECOUNT': str(size / 4)}
+
+ d0 = extract(data, params, ty='write', index=0)
+ d1 = extract(data, params, ty='write', index=1)
+
+ fp = open('%s-%d-write.data' % (params['BLUESKY_TARGET'], size), 'w')
+ for k in sorted(d0.keys()):
+ fp.write("%d\t%f\t%f\n" % (k, d0[k], d1[k]))
+ fp.close()