html report changed
diff --git a/report.html b/report.html
index b82cbbd..5e78689 100644
--- a/report.html
+++ b/report.html
@@ -1,11 +1,66 @@
<!DOCTYPE html>
<html>
<head>
- <title>Report</title>
+ <title>Report</title>
+ <link rel="stylesheet"
+ href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
-%(body)s
+<div class="page-header text-center">
+ <h2>Performance Report</h2>
+</div>
+<div class="container">
+ <div class="row">
+ <table style="width: auto;" class="table table-bordered table-striped">
+ <tr>
+ <td>Test</td>
+ <td>Iops</td>
+ <td>Latency</td>
+ </tr>
+ <tr>
+ <td>rand read 4k</td>
+ <td>{data[rand_read_4k][iops][0]} ± {data[rand_read_4k][iops][1]}</td>
+ <td>{data[rand_read_4k][lat]}</td>
+ </tr>
+ <tr>
+ <td>rand write 4k</td>
+ <td>{data[rand_write_4k][iops][0]} ± {data[rand_write_4k][iops][1]}</td>
+ <td>{data[rand_write_4k][lat]}</td>
+ </tr>
+ <tr></tr>
+ </table>
+ </div>
+ <div class="row">
+ <table>
+ <tr>
+ <td><img src={urls[0]}></td>
+ <td><img src={urls[1]}></td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="row">
+ <table style="width: auto;" class="table table-bordered table-striped">
+ <tr>
+ <td>Disk total</td>
+ <td>{lab_info[total_disk]}</td>
+ </tr>
+ <tr>
+ <td>Memory total</td>
+ <td>{lab_info[total_memory]}</td>
+ </tr>
+ <tr>
+ <td>Nodes count</td>
+ <td>{lab_info[nodes_count]}</td>
+ </tr>
+ <tr>
+ <td>CPU count</td>
+ <td>{lab_info[processor_count]}</td>
+ </tr>
+ </table>
+ </div>
+</div>
</body>
</html>
\ No newline at end of file
diff --git a/wally/report.py b/wally/report.py
index d2f2d96..d191428 100644
--- a/wally/report.py
+++ b/wally/report.py
@@ -2,151 +2,16 @@
import sys
from wally import charts
-from wally.statistic import med_dev
+from wally.statistic import med_dev, round_3_digit, round_deviation
from wally.utils import parse_creds
from wally.suits.io.results_loader import filter_data
from wally.meta_info import total_lab_info, collect_lab_data
-# from collections import OrderedDict
-# from wally.suits.io import formatter
-# def pgbench_chart_data(results):
-# """
-# Format pgbench results for chart
-# """
-# data = {}
-# charts_url = []
-
-# formatted_res = formatters.format_pgbench_stat(results)
-# for key, value in formatted_res.items():
-# num_cl, num_tr = key.split(' ')
-# data.setdefault(num_cl, {}).setdefault(build, {})
-# data[keys[z]][build][
-# ' '.join(keys)] = value
-
-# for name, value in data.items():
-# title = name
-# legend = []
-# dataset = []
-
-# scale_x = []
-
-# for build_id, build_results in value.items():
-# vals = []
-# OD = OrderedDict
-# ordered_build_results = OD(sorted(build_results.items(),
-# key=lambda t: t[0]))
-# scale_x = ordered_build_results.keys()
-# for key in scale_x:
-# res = build_results.get(key)
-# if res:
-# vals.append(res)
-# if vals:
-# dataset.append(vals)
-# legend.append(build_id)
-
-# if dataset:
-# charts_url.append(str(charts.render_vertical_bar
-# (title, legend, dataset, scale_x=scale_x)))
-# return charts_url
-
-# def build_lines_chart(results, z=0):
-# data = {}
-# charts_url = []
-
-# for build, res in results:
-# formatted_res = formatters.get_formatter(build)(res)
-# for key, value in formatted_res.items():
-# keys = key.split(' ')
-# data.setdefault(key[z], {})
-# data[key[z]].setdefault(build, {})[keys[1]] = value
-
-# for name, value in data.items():
-# title = name
-# legend = []
-# dataset = []
-# scale_x = []
-# for build_id, build_results in value.items():
-# legend.append(build_id)
-
-# OD = OrderedDict
-# ordered_build_results = OD(sorted(build_results.items(),
-# key=lambda t: ssize_to_b(t[0])))
-
-# if not scale_x:
-# scale_x = ordered_build_results.keys()
-# dataset.append(zip(*ordered_build_results.values())[0])
-
-# chart = charts.render_lines(title, legend, dataset, scale_x)
-# charts_url.append(str(chart))
-
-# return charts_url
-
-# def build_vertical_bar(results, z=0):
-# data = {}
-# charts_url = []
-# for build, res in results:
-# formatted_res = formatter.get_formatter(build)(res)
-# for key, value in formatted_res.items():
-# keys = key.split(' ')
-# data.setdefault(keys[z], {}).setdefault(build, {})
-# data[keys[z]][build][
-# ' '.join(keys)] = value
-
-# for name, value in data.items():
-# title = name
-# legend = []
-# dataset = []
-
-# scale_x = []
-
-# for build_id, build_results in value.items():
-# vals = []
-# OD = OrderedDict
-# ordered_build_results = OD(sorted(build_results.items(),
-# key=lambda t: t[0]))
-# scale_x = ordered_build_results.keys()
-# for key in scale_x:
-# res = build_results.get(key)
-# if res:
-# vals.append(res)
-# if vals:
-# dataset.append(vals)
-# legend.append(build_id)
-
-# if dataset:
-# charts_url.append(str(charts.render_vertical_bar
-# (title, legend, dataset, scale_x=scale_x)))
-# return charts_url
-
-
def render_html(charts_urls, dest, lab_description, info):
templ = open("report.html", 'r').read()
- body = "<a href='#lab_desc'>Lab description</a>" \
- "<ol>{0}</ol>" \
- "<div>{1}</div>" \
- '<a name="lab_desc"></a>' \
- "<div><ul>{2}</ul></div>"
- table = "<table><tr><td>{0}</td><td>{1}</td></tr>" \
- "<tr><td>{2}</td><td>{3}</td></tr></table>"
- ul = []
- ol = []
- li = '<li>{0} : {1}</li>'
-
- for elem in info:
- ol.append(li.format(elem.keys(), elem.values()))
-
- for key in lab_description:
- value = lab_description[key]
- ul.append("<li>{0} : {1}</li>".format(key, value))
-
- charts_urls = ['<img src="{0}">'.format(url) for url in charts_urls]
-
- body = body.format('\n'.join(ol),
- table.format(*charts_urls),
- '\n'.join(ul))
-
- open(dest, 'w').write(templ % {'body': body})
+ open(dest, 'w').write(templ.format(urls=charts_urls,
+ data=info, lab_info=lab_description))
def io_chart(title, concurence, latv, iops_or_bw, iops_or_bw_dev,
@@ -194,16 +59,18 @@
io_test_suite_res = test_suite_data['res']
charts_url = []
- info = []
+ max_info = {}
name_filters = [
- ('hdd_test_rrd4k', ('concurence', 'lat', 'iops'), 'rand_read_4k'),
- ('hdd_test_swd1m', ('concurence', 'lat', 'bw'), 'seq_write_1m'),
- ('hdd_test_srd1m', ('concurence', 'lat', 'bw'), 'seq_read_1m'),
- ('hdd_test_rws4k', ('concurence', 'lat', 'bw'), 'rand_write_1m')
+ ('hdd_test_rrd4k', ('concurence', 'lat', 'iops'),
+ 'rand_read_4k', 'random read 4k'),
+ # ('hdd_test_swd1m', ('concurence', 'lat', 'bw'), 'seq_write_1m'),
+ # ('hdd_test_srd1m', ('concurence', 'lat', 'bw'), 'seq_read_1m'),
+ ('hdd_test_rws4k', ('concurence', 'lat', 'iops'),
+ 'rand_write_4k', 'random write 4k')
]
- for name_filter, fields, fname in name_filters:
+ for name_filter, fields, fname, desc in name_filters:
th_filter = filter_data(name_filter, fields)
data = sorted(th_filter(io_test_suite_res.values()))
@@ -214,14 +81,20 @@
iops_or_bw_v, iops_or_bw_dev_v = zip(*map(med_dev, iops_or_bw_v))
latv, _ = zip(*map(med_dev, latv))
- url = io_chart(name_filter, concurence, latv, iops_or_bw_v,
+ url = io_chart(desc, concurence, latv, iops_or_bw_v,
iops_or_bw_dev_v,
fields[2], fname)
- info.append(dict(zip(fields, (concurence, latv, iops_or_bw_v))))
+ max_lat = "%s msec" % round_3_digit(max(latv) / 1000)
+ max_iops_or_bw = max(iops_or_bw_v)
+ max_iops_or_bw_dev = iops_or_bw_dev_v[
+ iops_or_bw_v.index(max_iops_or_bw)]
+ r = round_deviation((max_iops_or_bw, max_iops_or_bw_dev))
+ max_info[fname] = {fields[2]: r,
+ "lat": max_lat}
charts_url.append(url)
if len(charts_url) != 0:
- render_html(charts_url, path, lab_info, info)
+ render_html(charts_url, path, lab_info, max_info)
def main(args):