From f6edd13c644ec73c0f57aa580514413372ce3f0e Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Mon, 14 Feb 2011 15:06:03 -0800 Subject: [PATCH] Commit script to parse microbenchmark results. --- microbench/parse-results.py | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 microbench/parse-results.py diff --git a/microbench/parse-results.py b/microbench/parse-results.py new file mode 100755 index 0000000..64a17d3 --- /dev/null +++ b/microbench/parse-results.py @@ -0,0 +1,65 @@ +#!/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() -- 2.20.1