koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 1 | import os |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 2 | import bisect |
koder aka kdanilov | a047e1b | 2015-04-21 23:16:59 +0300 | [diff] [blame] | 3 | import logging |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 4 | |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 5 | try: |
| 6 | import matplotlib.pyplot as plt |
| 7 | except ImportError: |
| 8 | plt = None |
| 9 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 10 | import wally |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 11 | from wally import charts |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 12 | from wally.utils import ssize2b |
| 13 | from wally.statistic import round_3_digit, data_property |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 14 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 15 | |
koder aka kdanilov | a047e1b | 2015-04-21 23:16:59 +0300 | [diff] [blame] | 16 | logger = logging.getLogger("wally.report") |
| 17 | |
| 18 | |
koder aka kdanilov | 209e85d | 2015-04-27 23:11:05 +0300 | [diff] [blame] | 19 | class DiskInfo(object): |
| 20 | def __init__(self): |
| 21 | self.direct_iops_r_max = 0 |
| 22 | self.direct_iops_w_max = 0 |
| 23 | self.rws4k_10ms = 0 |
| 24 | self.rws4k_30ms = 0 |
| 25 | self.rws4k_100ms = 0 |
| 26 | self.bw_write_max = 0 |
| 27 | self.bw_read_max = 0 |
| 28 | |
| 29 | |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 30 | report_funcs = [] |
| 31 | |
| 32 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 33 | class PerfInfo(object): |
| 34 | def __init__(self, name, raw, meta): |
| 35 | self.name = name |
| 36 | self.bw = None |
| 37 | self.iops = None |
| 38 | self.lat = None |
| 39 | self.raw = raw |
| 40 | self.meta = meta |
| 41 | |
| 42 | |
| 43 | def split_and_add(data, block_size): |
| 44 | assert len(data) % block_size == 0 |
| 45 | res = [0] * block_size |
| 46 | |
| 47 | for idx, val in enumerate(data): |
| 48 | res[idx % block_size] += val |
| 49 | |
| 50 | return res |
| 51 | |
| 52 | |
| 53 | def process_disk_info(test_data): |
| 54 | data = {} |
| 55 | vm_count = test_data['__test_meta__']['testnodes_count'] |
| 56 | for name, results in test_data['res'].items(): |
| 57 | assert len(results['bw']) % vm_count == 0 |
| 58 | block_count = len(results['bw']) // vm_count |
| 59 | |
| 60 | pinfo = PerfInfo(name, results, test_data['__test_meta__']) |
| 61 | pinfo.bw = data_property(split_and_add(results['bw'], block_count)) |
| 62 | pinfo.iops = data_property(split_and_add(results['iops'], |
| 63 | block_count)) |
| 64 | |
| 65 | pinfo.lat = data_property(results['lat']) |
| 66 | data[name] = pinfo |
| 67 | return data |
| 68 | |
| 69 | |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 70 | def report(name, required_fields): |
| 71 | def closure(func): |
| 72 | report_funcs.append((required_fields.split(","), name, func)) |
| 73 | return func |
| 74 | return closure |
| 75 | |
| 76 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 77 | def linearity_report(processed_results, path, lab_info): |
| 78 | names = {} |
| 79 | for tp1 in ('rand', 'seq'): |
| 80 | for oper in ('read', 'write'): |
| 81 | for sync in ('sync', 'direct', 'async'): |
| 82 | sq = (tp1, oper, sync) |
| 83 | name = "{0} {1} {2}".format(*sq) |
| 84 | names["".join(word[0] for word in sq)] = name |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 85 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 86 | colors = ['red', 'green', 'blue', 'cyan', |
| 87 | 'magenta', 'black', 'yellow', 'burlywood'] |
| 88 | markers = ['*', '^', 'x', 'o', '+', '.'] |
| 89 | color = 0 |
| 90 | marker = 0 |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 91 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 92 | plot_data = {} |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 93 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 94 | name_pref = 'linearity_test_rrd' |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 95 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 96 | for res in processed_results.values(): |
| 97 | if res.name.startswith(name_pref): |
| 98 | iotime = 1000000. / res.iops |
| 99 | iotime_max = iotime * (1 + res.dev * 3) |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 100 | bsize = ssize2b(res.raw['blocksize']) |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 101 | plot_data[bsize] = (iotime, iotime_max) |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 102 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 103 | min_sz = min(plot_data) |
| 104 | min_iotime, _ = plot_data.pop(min_sz) |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 105 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 106 | x = [] |
| 107 | y = [] |
| 108 | e = [] |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 109 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 110 | for k, (v, vmax) in sorted(plot_data.items()): |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 111 | y.append(v - min_iotime) |
| 112 | x.append(k) |
| 113 | e.append(y[-1] - (vmax - min_iotime)) |
| 114 | |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 115 | tp = 'rrd' |
| 116 | plt.errorbar(x, y, e, linestyle='None', label=names[tp], |
| 117 | color=colors[color], ecolor="black", |
| 118 | marker=markers[marker]) |
| 119 | plt.yscale('log') |
| 120 | plt.xscale('log') |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 121 | # plt.show() |
koder aka kdanilov | 63e9c5a | 2015-04-28 23:06:07 +0300 | [diff] [blame] | 122 | |
| 123 | # ynew = approximate_line(ax, ay, ax, True) |
| 124 | # plt.plot(ax, ynew, color=colors[color]) |
| 125 | # color += 1 |
| 126 | # marker += 1 |
| 127 | # plt.legend(loc=2) |
| 128 | # plt.title("Linearity test by %i dots" % (len(vals))) |
| 129 | |
| 130 | |
| 131 | if plt: |
| 132 | linearity_report = report('linearity', 'linearity_test')(linearity_report) |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 133 | |
| 134 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 135 | def render_all_html(dest, info, lab_description, img_ext, templ_name): |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 136 | very_root_dir = os.path.dirname(os.path.dirname(wally.__file__)) |
| 137 | templ_dir = os.path.join(very_root_dir, 'report_templates') |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 138 | templ_file = os.path.join(templ_dir, templ_name) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 139 | templ = open(templ_file, 'r').read() |
koder aka kdanilov | 209e85d | 2015-04-27 23:11:05 +0300 | [diff] [blame] | 140 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 141 | data = info.__dict__.copy() |
| 142 | for name, val in data.items(): |
koder aka kdanilov | 209e85d | 2015-04-27 23:11:05 +0300 | [diff] [blame] | 143 | if not name.startswith('__'): |
koder aka kdanilov | c368eb6 | 2015-04-28 18:22:01 +0300 | [diff] [blame] | 144 | if val is None: |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 145 | data[name] = '-' |
| 146 | elif isinstance(val, (int, float, long)): |
| 147 | data[name] = round_3_digit(val) |
koder aka kdanilov | 209e85d | 2015-04-27 23:11:05 +0300 | [diff] [blame] | 148 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 149 | data['bw_read_max'] = (data['bw_read_max'][0] // 1024, |
| 150 | data['bw_read_max'][1]) |
| 151 | data['bw_write_max'] = (data['bw_write_max'][0] // 1024, |
| 152 | data['bw_write_max'][1]) |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 153 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 154 | report = templ.format(lab_info=lab_description, img_ext=img_ext, |
| 155 | **data) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 156 | open(dest, 'w').write(report) |
| 157 | |
| 158 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 159 | def render_hdd_html(dest, info, lab_description, img_ext): |
| 160 | render_all_html(dest, info, lab_description, img_ext, |
| 161 | "report_hdd.html") |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 162 | |
| 163 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 164 | def render_ceph_html(dest, info, lab_description, img_ext): |
| 165 | render_all_html(dest, info, lab_description, img_ext, |
| 166 | "report_ceph.html") |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 167 | |
| 168 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 169 | def io_chart(title, concurence, |
| 170 | latv, latv_min, latv_max, |
| 171 | iops_or_bw, iops_or_bw_dev, |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 172 | legend, fname): |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 173 | bar_data = iops_or_bw |
| 174 | bar_dev = iops_or_bw_dev |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 175 | legend = [legend] |
| 176 | |
| 177 | iops_or_bw_per_vm = [] |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 178 | for iops, conc in zip(iops_or_bw, concurence): |
| 179 | iops_or_bw_per_vm.append(iops / conc) |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 180 | |
| 181 | bar_dev_bottom = [] |
| 182 | bar_dev_top = [] |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 183 | for val, err in zip(bar_data, bar_dev): |
| 184 | bar_dev_top.append(val + err) |
| 185 | bar_dev_bottom.append(val - err) |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 186 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 187 | charts.render_vertical_bar(title, legend, [bar_data], [bar_dev_top], |
| 188 | [bar_dev_bottom], file_name=fname, |
| 189 | scale_x=concurence, label_x="clients", |
| 190 | label_y=legend[0], |
| 191 | lines=[ |
| 192 | (latv, "msec", "rr", "lat"), |
| 193 | # (latv_min, None, None, "lat_min"), |
| 194 | # (latv_max, None, None, "lat_max"), |
| 195 | (iops_or_bw_per_vm, None, None, |
| 196 | legend[0] + " per client") |
| 197 | ]) |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 198 | |
| 199 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 200 | def io_chart_mpl(title, concurence, |
| 201 | latv, latv_min, latv_max, |
| 202 | iops_or_bw, iops_or_bw_err, |
| 203 | legend, fname): |
| 204 | points = " MiBps" if legend == 'BW' else "" |
| 205 | lc = len(concurence) |
| 206 | width = 0.35 |
| 207 | xt = range(1, lc + 1) |
| 208 | |
| 209 | op_per_vm = [v / c for v, c in zip(iops_or_bw, concurence)] |
| 210 | fig, p1 = plt.subplots() |
| 211 | xpos = [i - width / 2 for i in xt] |
| 212 | |
| 213 | p1.bar(xpos, iops_or_bw, width=width, yerr=iops_or_bw_err, |
| 214 | color='y', |
| 215 | label=legend) |
| 216 | |
| 217 | p1.set_yscale('log') |
| 218 | p1.grid(True) |
| 219 | p1.plot(xt, op_per_vm, label=legend + " per vm") |
| 220 | p1.legend() |
| 221 | |
| 222 | p2 = p1.twinx() |
| 223 | p2.set_yscale('log') |
| 224 | p2.plot(xt, latv_max, label="latency max") |
| 225 | p2.plot(xt, latv, label="latency avg") |
| 226 | p2.plot(xt, latv_min, label="latency min") |
| 227 | |
| 228 | plt.xlim(0.5, lc + 0.5) |
| 229 | plt.xticks(xt, map(str, concurence)) |
| 230 | p1.set_xlabel("Threads") |
| 231 | p1.set_ylabel(legend + points) |
| 232 | p2.set_ylabel("Latency ms") |
| 233 | plt.title(title) |
| 234 | # plt.legend(, loc=2, borderaxespad=0.) |
| 235 | # plt.legend(bbox_to_anchor=(1.05, 1), loc=2) |
| 236 | plt.legend(loc=2) |
| 237 | plt.savefig(fname, format=fname.split('.')[-1]) |
| 238 | |
| 239 | |
| 240 | def make_hdd_plots(processed_results, charts_dir): |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 241 | plots = [ |
| 242 | ('hdd_test_rrd4k', 'rand_read_4k', 'Random read 4k direct IOPS'), |
koder aka kdanilov | ea7eac7 | 2015-04-21 21:37:27 +0300 | [diff] [blame] | 243 | ('hdd_test_rws4k', 'rand_write_4k', 'Random write 4k sync IOPS') |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 244 | ] |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 245 | return make_plots(processed_results, charts_dir, plots) |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 246 | |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 247 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 248 | def make_ceph_plots(processed_results, charts_dir): |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 249 | plots = [ |
| 250 | ('ceph_test_rrd4k', 'rand_read_4k', 'Random read 4k direct IOPS'), |
| 251 | ('ceph_test_rws4k', 'rand_write_4k', 'Random write 4k sync IOPS'), |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 252 | ('ceph_test_rrd16m', 'rand_read_16m', |
| 253 | 'Random read 16m direct MiBps'), |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 254 | ('ceph_test_rwd16m', 'rand_write_16m', |
| 255 | 'Random write 16m direct MiBps'), |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 256 | ] |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 257 | return make_plots(processed_results, charts_dir, plots) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 258 | |
| 259 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 260 | def make_plots(processed_results, charts_dir, plots): |
| 261 | file_ext = None |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 262 | for name_pref, fname, desc in plots: |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 263 | chart_data = [] |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 264 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 265 | for res in processed_results.values(): |
| 266 | if res.name.startswith(name_pref): |
| 267 | chart_data.append(res) |
| 268 | |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 269 | if len(chart_data) == 0: |
| 270 | raise ValueError("Can't found any date for " + name_pref) |
| 271 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 272 | use_bw = ssize2b(chart_data[0].raw['blocksize']) > 16 * 1024 |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 273 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 274 | chart_data.sort(key=lambda x: x.raw['concurence']) |
| 275 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 276 | # if x.lat.average < max_lat] |
| 277 | lat = [x.lat.average / 1000 for x in chart_data] |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 278 | lat_min = [x.lat.min / 1000 for x in chart_data] |
| 279 | lat_max = [x.lat.max / 1000 for x in chart_data] |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 280 | |
koder aka kdanilov | 209e85d | 2015-04-27 23:11:05 +0300 | [diff] [blame] | 281 | vm_count = x.meta['testnodes_count'] |
| 282 | concurence = [x.raw['concurence'] * vm_count for x in chart_data] |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 283 | |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 284 | if use_bw: |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 285 | data = [x.bw.average / 1000 for x in chart_data] |
| 286 | data_dev = [x.bw.confidence / 1000 for x in chart_data] |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 287 | name = "BW" |
| 288 | else: |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 289 | data = [x.iops.average for x in chart_data] |
| 290 | data_dev = [x.iops.confidence for x in chart_data] |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 291 | name = "IOPS" |
| 292 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 293 | fname = os.path.join(charts_dir, fname) |
| 294 | if plt is not None: |
| 295 | io_chart_mpl(desc, concurence, lat, lat_min, lat_max, |
| 296 | data, data_dev, name, fname + '.svg') |
| 297 | file_ext = 'svg' |
| 298 | else: |
| 299 | io_chart(desc, concurence, lat, lat_min, lat_max, |
| 300 | data, data_dev, name, fname + '.png') |
| 301 | file_ext = 'png' |
| 302 | return file_ext |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 303 | |
| 304 | |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 305 | def find_max_where(processed_results, sync_mode, blocksize, rw, iops=True): |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 306 | result = None |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 307 | attr = 'iops' if iops else 'bw' |
| 308 | for measurement in processed_results.values(): |
| 309 | ok = measurement.raw['sync_mode'] == sync_mode |
| 310 | ok = ok and (measurement.raw['blocksize'] == blocksize) |
| 311 | ok = ok and (measurement.raw['rw'] == rw) |
| 312 | |
| 313 | if ok: |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 314 | field = getattr(measurement, attr) |
| 315 | |
| 316 | if result is None: |
| 317 | result = field |
| 318 | elif field.average > result.average: |
| 319 | result = field |
| 320 | |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 321 | return result |
| 322 | |
| 323 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 324 | def get_disk_info(processed_results): |
| 325 | di = DiskInfo() |
| 326 | rws4k_iops_lat_th = [] |
| 327 | |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 328 | di.direct_iops_w_max = find_max_where(processed_results, |
| 329 | 'd', '4k', 'randwrite') |
| 330 | di.direct_iops_r_max = find_max_where(processed_results, |
| 331 | 'd', '4k', 'randread') |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 332 | |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 333 | di.bw_write_max = find_max_where(processed_results, |
| 334 | 'd', '16m', 'randwrite', False) |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 335 | if di.bw_write_max is None: |
| 336 | di.bw_write_max = find_max_where(processed_results, |
| 337 | 'd', '1m', 'write', False) |
| 338 | |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 339 | di.bw_read_max = find_max_where(processed_results, |
| 340 | 'd', '16m', 'randread', False) |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 341 | if di.bw_read_max is None: |
| 342 | di.bw_read_max = find_max_where(processed_results, |
| 343 | 'd', '1m', 'read', False) |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 344 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 345 | for res in processed_results.values(): |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 346 | if res.raw['sync_mode'] == 's' and res.raw['blocksize'] == '4k': |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 347 | if res.raw['rw'] != 'randwrite': |
| 348 | continue |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 349 | rws4k_iops_lat_th.append((res.iops.average, |
| 350 | res.lat.average, |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 351 | res.raw['concurence'])) |
| 352 | |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 353 | rws4k_iops_lat_th.sort(key=lambda (_1, _2, conc): conc) |
| 354 | |
| 355 | latv = [lat for _, lat, _ in rws4k_iops_lat_th] |
| 356 | |
| 357 | for tlatv_ms in [10, 30, 100]: |
| 358 | tlat = tlatv_ms * 1000 |
| 359 | pos = bisect.bisect_left(latv, tlat) |
| 360 | if 0 == pos: |
| 361 | iops3 = 0 |
| 362 | elif pos == len(latv): |
| 363 | iops3 = latv[-1] |
| 364 | else: |
| 365 | lat1 = latv[pos - 1] |
| 366 | lat2 = latv[pos] |
| 367 | |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 368 | iops1, _, th1 = rws4k_iops_lat_th[pos - 1] |
| 369 | iops2, _, th2 = rws4k_iops_lat_th[pos] |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 370 | |
| 371 | th_lat_coef = (th2 - th1) / (lat2 - lat1) |
| 372 | th3 = th_lat_coef * (tlat - lat1) + th1 |
| 373 | |
| 374 | th_iops_coef = (iops2 - iops1) / (th2 - th1) |
| 375 | iops3 = th_iops_coef * (th3 - th1) + iops1 |
| 376 | setattr(di, 'rws4k_{}ms'.format(tlatv_ms), int(iops3)) |
| 377 | |
| 378 | hdi = DiskInfo() |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 379 | |
| 380 | def pp(x): |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 381 | med, conf = x.rounded_average_conf() |
| 382 | conf_perc = int(float(conf) / med * 100) |
| 383 | return (med, conf_perc) |
koder aka kdanilov | 7e0f7cf | 2015-05-01 17:24:35 +0300 | [diff] [blame] | 384 | |
| 385 | hdi.direct_iops_r_max = pp(di.direct_iops_r_max) |
| 386 | hdi.direct_iops_w_max = pp(di.direct_iops_w_max) |
| 387 | hdi.bw_write_max = pp(di.bw_write_max) |
| 388 | hdi.bw_read_max = pp(di.bw_read_max) |
| 389 | |
koder aka kdanilov | c368eb6 | 2015-04-28 18:22:01 +0300 | [diff] [blame] | 390 | hdi.rws4k_10ms = di.rws4k_10ms if 0 != di.rws4k_10ms else None |
| 391 | hdi.rws4k_30ms = di.rws4k_30ms if 0 != di.rws4k_30ms else None |
| 392 | hdi.rws4k_100ms = di.rws4k_100ms if 0 != di.rws4k_100ms else None |
koder aka kdanilov | 4a510ee | 2015-04-21 18:50:42 +0300 | [diff] [blame] | 393 | return hdi |
| 394 | |
| 395 | |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 396 | @report('HDD', 'hdd_test_rrd4k,hdd_test_rws4k') |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 397 | def make_hdd_report(processed_results, path, charts_path, lab_info): |
| 398 | img_ext = make_hdd_plots(processed_results, charts_path) |
koder aka kdanilov | a4a570f | 2015-04-23 22:11:40 +0300 | [diff] [blame] | 399 | di = get_disk_info(processed_results) |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 400 | render_hdd_html(path, di, lab_info, img_ext) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 401 | |
| 402 | |
| 403 | @report('Ceph', 'ceph_test') |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 404 | def make_ceph_report(processed_results, path, charts_path, lab_info): |
| 405 | img_ext = make_ceph_plots(processed_results, charts_path) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 406 | di = get_disk_info(processed_results) |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 407 | render_ceph_html(path, di, lab_info, img_ext) |
koder aka kdanilov | a4a570f | 2015-04-23 22:11:40 +0300 | [diff] [blame] | 408 | |
| 409 | |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 410 | def make_io_report(dinfo, results, path, charts_path, lab_info=None): |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 411 | lab_info = { |
| 412 | "total_disk": "None", |
| 413 | "total_memory": "None", |
| 414 | "nodes_count": "None", |
| 415 | "processor_count": "None" |
| 416 | } |
koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame] | 417 | |
koder aka kdanilov | a047e1b | 2015-04-21 23:16:59 +0300 | [diff] [blame] | 418 | try: |
koder aka kdanilov | f86d7af | 2015-05-06 04:01:54 +0300 | [diff] [blame] | 419 | res_fields = sorted(dinfo.keys()) |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 420 | for fields, name, func in report_funcs: |
koder aka kdanilov | afd9874 | 2015-04-24 01:27:22 +0300 | [diff] [blame] | 421 | for field in fields: |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 422 | pos = bisect.bisect_left(res_fields, field) |
| 423 | |
| 424 | if pos == len(res_fields): |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 425 | break |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 426 | |
koder aka kdanilov | be8f89f | 2015-04-28 14:51:51 +0300 | [diff] [blame] | 427 | if not res_fields[pos].startswith(field): |
koder aka kdanilov | afd9874 | 2015-04-24 01:27:22 +0300 | [diff] [blame] | 428 | break |
| 429 | else: |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 430 | hpath = path.format(name) |
koder aka kdanilov | 63ad206 | 2015-04-27 13:11:40 +0300 | [diff] [blame] | 431 | logger.debug("Generatins report " + name + " into " + hpath) |
koder aka kdanilov | d5ed4da | 2015-05-07 23:33:23 +0300 | [diff] [blame^] | 432 | func(dinfo, hpath, charts_path, lab_info) |
koder aka kdanilov | afd9874 | 2015-04-24 01:27:22 +0300 | [diff] [blame] | 433 | break |
koder aka kdanilov | a4a570f | 2015-04-23 22:11:40 +0300 | [diff] [blame] | 434 | else: |
| 435 | logger.warning("No report generator found for this load") |
koder aka kdanilov | afd9874 | 2015-04-24 01:27:22 +0300 | [diff] [blame] | 436 | |
koder aka kdanilov | a047e1b | 2015-04-21 23:16:59 +0300 | [diff] [blame] | 437 | except Exception as exc: |
koder aka kdanilov | 57ce4db | 2015-04-25 21:25:51 +0300 | [diff] [blame] | 438 | import traceback |
| 439 | traceback.print_exc() |
koder aka kdanilov | ec1b973 | 2015-04-23 20:43:29 +0300 | [diff] [blame] | 440 | logger.error("Failed to generate html report:" + str(exc)) |