koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 1 | import sys |
koder aka kdanilov | da45e88 | 2015-04-06 02:24:42 +0300 | [diff] [blame] | 2 | from data_stat import med_dev, round_deviation, groupby_globally |
| 3 | from data_stat import read_data_agent_result |
koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 4 | |
| 5 | |
| 6 | def 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 kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 13 | template = "{bs:>4} {action:>12} {cache_tp:>3} {conc:>4}" |
| 14 | template += " | {iops[0]:>6} ~ {iops[1]:>5} | {bw[0]:>7} ~ {bw[1]:>6}" |
| 15 | template += " | {lat[0]:>6} ~ {lat[1]:>5} |" |
| 16 | |
| 17 | headers = 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 | |
| 26 | def main(argv): |
koder aka kdanilov | da45e88 | 2015-04-06 02:24:42 +0300 | [diff] [blame] | 27 | data = read_data_agent_result(sys.argv[1]) |
koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 28 | 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 kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 34 | bw = med_dev([i['bw'] * int(conc) for i in curr_data]) |
koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 35 | lat = med_dev([i['lat'] / 1000 for i in curr_data]) |
| 36 | |
| 37 | iops = round_deviation(iops) |
koder aka kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 38 | bw = round_deviation(bw) |
koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 39 | lat = round_deviation(lat) |
| 40 | |
| 41 | params = dict( |
| 42 | bs=bs, |
| 43 | action=act, |
| 44 | cache_tp=cache_tp, |
| 45 | iops=iops, |
koder aka kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 46 | bw=bw, |
koder aka kdanilov | 8ad6e81 | 2015-03-22 14:42:18 +0200 | [diff] [blame] | 47 | lat=lat, |
| 48 | conc=conc |
| 49 | ) |
| 50 | |
| 51 | print template.format(**params) |
| 52 | |
| 53 | |
| 54 | if __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) |