summaryrefslogtreecommitdiff
path: root/tools/hist/half-bins.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/hist/half-bins.py')
-rwxr-xr-xtools/hist/half-bins.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/tools/hist/half-bins.py b/tools/hist/half-bins.py
deleted file mode 100755
index d592af00..00000000
--- a/tools/hist/half-bins.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python2.7
-""" Cut the number bins in half in fio histogram output. Example usage:
-
- $ half-bins.py -c 2 output_clat_hist.1.log > smaller_clat_hist.1.log
-
- Which merges e.g. bins [0 .. 3], [4 .. 7], ..., [1212 .. 1215] resulting in
- 304 = 1216 / (2**2) merged bins per histogram sample.
-
- @author Karl Cronburg <karl.cronburg@gmail.com>
-"""
-import sys
-
-def main(ctx):
- stride = 1 << ctx.coarseness
- with open(ctx.FILENAME, 'r') as fp:
- for line in fp.readlines():
- vals = line.split(', ')
- sys.stdout.write("%s, %s, %s, " % tuple(vals[:3]))
-
- hist = list(map(int, vals[3:]))
- for i in range(0, len(hist) - stride, stride):
- sys.stdout.write("%d, " % sum(hist[i : i + stride],))
- sys.stdout.write("%d\n" % sum(hist[len(hist) - stride:]))
-
-if __name__ == '__main__':
- import argparse
- p = argparse.ArgumentParser()
- arg = p.add_argument
- arg( 'FILENAME', help='clat_hist file for which we will reduce'
- ' (by half or more) the number of bins.')
- arg('-c', '--coarseness',
- default=1,
- type=int,
- help='number of times to reduce number of bins by half, '
- 'e.g. coarseness of 4 merges each 2^4 = 16 consecutive '
- 'bins.')
- main(p.parse_args())
-