X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Ftest%2Fbench%2Fsmalliobenchprocessor.py;fp=src%2Fceph%2Fsrc%2Ftest%2Fbench%2Fsmalliobenchprocessor.py;h=7286db9640155c1ddd7573c8b0b511f2c544f77c;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/test/bench/smalliobenchprocessor.py b/src/ceph/src/test/bench/smalliobenchprocessor.py new file mode 100644 index 0000000..7286db9 --- /dev/null +++ b/src/ceph/src/test/bench/smalliobenchprocessor.py @@ -0,0 +1,43 @@ +import json +import sys +from pylab import hist +import gzip +import io + +def get_next_line(line, output): + val = json.loads(line) + if val['type'] not in output: + output[val['type']] = {} + for (name, value) in val.items(): + if name == "type": + continue + if name == "seq": + continue + if name not in output[val['type']]: + output[val['type']][name] = [] + output[val['type']][name] += [float(value)] + +def wrapgz(gfilename): + gfile = gzip.open(gfilename, 'rb') + if sys.version_info[0] >= 3: + gfile = io.TextIOWrapper(gfile) + return gfile + +def read_all_input(filename): + cur = {} + openfn = open + if ".gz" in filename: + openfn = wrapgz + with openfn(filename) as fh: + for line in fh: + get_next_line(line, cur) + return cur + +def write_committed_latency(out, bins, **kwargs): + hist(out['write_committed']['latency'], bins, **kwargs) + +def read_latency(out): + hist(out['read']['latency'], 100) + +def com(out): return out['write_committed']['latency'] +def app(out): return out['write_applied']['latency']