blob: 1ba3b587bee380bc8043cab744c54db2d574a4d3 [file] [log] [blame]
koder aka kdanilov8ad6e812015-03-22 14:42:18 +02001import sys
koder aka kdanilovda45e882015-04-06 02:24:42 +03002from data_stat import med_dev, round_deviation, groupby_globally
3from data_stat import read_data_agent_result
koder aka kdanilov8ad6e812015-03-22 14:42:18 +02004
5
6def key(x):
7 return (x['__meta__']['blocksize'],
8 'd' if x['__meta__']['direct_io'] else 's',
9 x['__meta__']['action'],
10 x['__meta__']['concurence'])
11
12
koder aka kdanilov8ad6e812015-03-22 14:42:18 +020013template = "{bs:>4} {action:>12} {cache_tp:>3} {conc:>4}"
14template += " | {iops[0]:>6} ~ {iops[1]:>5} | {bw[0]:>7} ~ {bw[1]:>6}"
15template += " | {lat[0]:>6} ~ {lat[1]:>5} |"
16
17headers = dict(bs="BS",
18 action="operation",
19 cache_tp="S/D",
20 conc="CONC",
21 iops=("IOPS", "dev"),
22 bw=("BW kBps", "dev"),
23 lat=("LAT ms", "dev"))
24
25
26def main(argv):
koder aka kdanilovda45e882015-04-06 02:24:42 +030027 data = read_data_agent_result(sys.argv[1])
koder aka kdanilov8ad6e812015-03-22 14:42:18 +020028 grouped = groupby_globally(data, key)
29
30 print template.format(**headers)
31
32 for (bs, cache_tp, act, conc), curr_data in sorted(grouped.items()):
33 iops = med_dev([i['iops'] * int(conc) for i in curr_data])
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030034 bw = med_dev([i['bw'] * int(conc) for i in curr_data])
koder aka kdanilov8ad6e812015-03-22 14:42:18 +020035 lat = med_dev([i['lat'] / 1000 for i in curr_data])
36
37 iops = round_deviation(iops)
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030038 bw = round_deviation(bw)
koder aka kdanilov8ad6e812015-03-22 14:42:18 +020039 lat = round_deviation(lat)
40
41 params = dict(
42 bs=bs,
43 action=act,
44 cache_tp=cache_tp,
45 iops=iops,
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030046 bw=bw,
koder aka kdanilov8ad6e812015-03-22 14:42:18 +020047 lat=lat,
48 conc=conc
49 )
50
51 print template.format(**params)
52
53
54if __name__ == "__main__":
55 exit(main(sys.argv))
56
57 # vals = [(123, 23), (125678, 5678), (123.546756, 23.77),
58 # (123.546756, 102.77), (0.1234, 0.0224),
59 # (0.001234, 0.000224), (0.001234, 0.0000224)]
60 # for val in :
61 # print val, "=>", round_deviation(val)