koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 1 | import texttable |
| 2 | |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 3 | from utils import ssize_to_b |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 4 | from statistic import med_dev |
koder aka kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 5 | from disk_perf_test_tool.tests.disk_test_agent import get_test_summary |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 6 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 7 | |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 8 | def key_func(k_data): |
| 9 | _, data = k_data |
| 10 | |
| 11 | bsz = ssize_to_b(data['blocksize']) |
koder aka kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 12 | tp = data['rw'] |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 13 | return tp, data['sync_mode'], bsz, data['concurence'] |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 14 | |
| 15 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 16 | def format_results_for_console(test_set): |
| 17 | data_for_print = [] |
| 18 | tab = texttable.Texttable() |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 19 | tab.set_deco(tab.HEADER | tab.VLINES | tab.BORDER) |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 20 | tab.set_cols_align(["l", "r", "r", "r", "r"]) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 21 | |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 22 | 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 kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 34 | descr = get_test_summary(data) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 35 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 36 | iops, _ = med_dev(data['iops']) |
koder aka kdanilov | 4e9f3ed | 2015-04-14 11:26:12 +0300 | [diff] [blame] | 37 | bw, bwdev = med_dev(data['bw']) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 38 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 39 | # 3 * sigma |
| 40 | dev_perc = int((bwdev * 300) / bw) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 41 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 42 | params = (descr, int(iops), int(bw), dev_perc, |
| 43 | int(med_dev(data['lat'])[0]) // 1000) |
| 44 | data_for_print.append(params) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 45 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 46 | header = ["Description", "IOPS", "BW KBps", "Dev * 3 %", "LAT ms"] |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 47 | tab.header(header) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 48 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 49 | map(tab.add_row, data_for_print) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 50 | |
koder aka kdanilov | 66839a9 | 2015-04-11 13:22:31 +0300 | [diff] [blame] | 51 | return tab.draw() |