blob: 185cae5267139b669e6c07cf5e3c6fa111c0e308 [file] [log] [blame]
koder aka kdanilov66839a92015-04-11 13:22:31 +03001import texttable
2
koder aka kdanilov652cd802015-04-13 12:21:07 +03003from utils import ssize_to_b
koder aka kdanilov66839a92015-04-11 13:22:31 +03004from statistic import med_dev
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +03005from disk_perf_test_tool.tests.disk_test_agent import get_test_summary
koder aka kdanilov66839a92015-04-11 13:22:31 +03006
koder aka kdanilov66839a92015-04-11 13:22:31 +03007
koder aka kdanilov652cd802015-04-13 12:21:07 +03008def key_func(k_data):
9 _, data = k_data
10
11 bsz = ssize_to_b(data['blocksize'])
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030012 tp = data['rw']
koder aka kdanilov652cd802015-04-13 12:21:07 +030013 return tp, data['sync_mode'], bsz, data['concurence']
Yulia Portnova7ddfa732015-02-24 17:32:58 +020014
15
koder aka kdanilov66839a92015-04-11 13:22:31 +030016def format_results_for_console(test_set):
17 data_for_print = []
18 tab = texttable.Texttable()
koder aka kdanilov652cd802015-04-13 12:21:07 +030019 tab.set_deco(tab.HEADER | tab.VLINES | tab.BORDER)
koder aka kdanilov66839a92015-04-11 13:22:31 +030020 tab.set_cols_align(["l", "r", "r", "r", "r"])
Yulia Portnova7ddfa732015-02-24 17:32:58 +020021
koder aka kdanilov652cd802015-04-13 12:21:07 +030022 items = sorted(test_set['res'].items(), key=key_func)
23 prev_k = None
24
25 for test_name, data in items:
26 curr_k = key_func((test_name, data))[:3]
27
28 if prev_k is not None:
29 if prev_k != curr_k:
30 data_for_print.append(["---"] * 5)
31
32 prev_k = curr_k
33
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030034 descr = get_test_summary(data)
Yulia Portnova7ddfa732015-02-24 17:32:58 +020035
koder aka kdanilov66839a92015-04-11 13:22:31 +030036 iops, _ = med_dev(data['iops'])
koder aka kdanilov4e9f3ed2015-04-14 11:26:12 +030037 bw, bwdev = med_dev(data['bw'])
Yulia Portnova7ddfa732015-02-24 17:32:58 +020038
koder aka kdanilov66839a92015-04-11 13:22:31 +030039 # 3 * sigma
40 dev_perc = int((bwdev * 300) / bw)
Yulia Portnova7ddfa732015-02-24 17:32:58 +020041
koder aka kdanilov66839a92015-04-11 13:22:31 +030042 params = (descr, int(iops), int(bw), dev_perc,
43 int(med_dev(data['lat'])[0]) // 1000)
44 data_for_print.append(params)
Yulia Portnova7ddfa732015-02-24 17:32:58 +020045
koder aka kdanilov66839a92015-04-11 13:22:31 +030046 header = ["Description", "IOPS", "BW KBps", "Dev * 3 %", "LAT ms"]
koder aka kdanilov652cd802015-04-13 12:21:07 +030047 tab.header(header)
Yulia Portnova7ddfa732015-02-24 17:32:58 +020048
koder aka kdanilov66839a92015-04-11 13:22:31 +030049 map(tab.add_row, data_for_print)
Yulia Portnova7ddfa732015-02-24 17:32:58 +020050
koder aka kdanilov66839a92015-04-11 13:22:31 +030051 return tab.draw()