Add proper per-file copyright notices/licenses and top-level license.
[bluesky.git] / microbench / parse-results.py
index f1da56c..cfc826d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/python2
 
-import os, re
+import os, re, sys
 
 def load_results(prefix):
     settings_file = open(prefix + ".settings")
@@ -49,26 +49,42 @@ def extract(data, params={}, ty='read', index=0):
         for t in ty:
             vals = [x[t][index] for x in r]
             vals = vals[5:]
-            vs += sum(vals) / len(vals)
+            vs += sum(vals) / (len(vals) or 1)
         results[ops] = vs
 
     return results
 
 data = []
 if __name__ == '__main__':
-    for f in os.listdir('results'):
+    dirname = '20110310'
+    for f in os.listdir(dirname):
         if f.endswith('.settings'):
-            data.append(load_results('results/' + f[:-len('.settings')]))
+            data.append(load_results(dirname + '/' + f[:-len('.settings')]))
 
 ratios = {'read': '0.0', 'write': '1.0', 'mixed': '0.5'}
 
-for size in [128, 512, 1024, 2048]:
-    for blocksize in [4096, 32768]:
+blocksizes = set(int(s[0]['BENCH_BLOCKSIZE'])
+                   or int(s[0]['BENCH_FILESIZE'])
+                 for s in data)
+print blocksizes
+sizes = set(int(s[0]['BENCH_FILESIZE']) * int(s[0]['BENCH_FILECOUNT']) / 1024**2
+                for s in data)
+print sizes
+
+for size in sorted(sizes):
+    for blocksize in sorted(blocksizes):
         for ratio in ratios:
-            params = {'BLUESKY_TARGET': 's3',
+            params = {'BLUESKY_TARGET': 's3:mvrable-bluesky-west',
                       'BENCH_WRITERATIO': ratios[ratio],
                       'BENCH_FILECOUNT': str(size),
                       'BENCH_BLOCKSIZE': str(blocksize)}
+            basesize = 1 << 20
+            if blocksize < basesize:
+                params['BENCH_BLOCKSIZE'] = str(blocksize)
+                params['BENCH_FILESIZE'] = str(basesize)
+            elif blocksize >= basesize:
+                params['BENCH_BLOCKSIZE'] = str(0)
+                params['BENCH_FILESIZE'] = str(blocksize)
 
             d0 = extract(data, params, ty=ratio, index=0)
             d1 = extract(data, params, ty=ratio, index=1)