]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/bench/smalliobenchprocessor.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / test / bench / smalliobenchprocessor.py
CommitLineData
7c673cae
FG
1import json
2import sys
3from pylab import hist
4import gzip
5import io
6
7def get_next_line(line, output):
8 val = json.loads(line)
9 if val['type'] not in output:
10 output[val['type']] = {}
11 for (name, value) in val.items():
12 if name == "type":
13 continue
14 if name == "seq":
15 continue
16 if name not in output[val['type']]:
17 output[val['type']][name] = []
18 output[val['type']][name] += [float(value)]
19
20def wrapgz(gfilename):
21 gfile = gzip.open(gfilename, 'rb')
22 if sys.version_info[0] >= 3:
23 gfile = io.TextIOWrapper(gfile)
24 return gfile
25
26def read_all_input(filename):
27 cur = {}
28 openfn = open
29 if ".gz" in filename:
30 openfn = wrapgz
31 with openfn(filename) as fh:
32 for line in fh:
33 get_next_line(line, cur)
34 return cur
35
36def write_committed_latency(out, bins, **kwargs):
37 hist(out['write_committed']['latency'], bins, **kwargs)
38
39def read_latency(out):
40 hist(out['read']['latency'], 100)
41
42def com(out): return out['write_committed']['latency']
43def app(out): return out['write_applied']['latency']