fixes in ceph tests, add linearity plot
diff --git a/wally/assumptions_check.py b/wally/assumptions_check.py
deleted file mode 100644
index 94297c3..0000000
--- a/wally/assumptions_check.py
+++ /dev/null
@@ -1,122 +0,0 @@
-import sys
-
-import texttable as TT
-
-import numpy as np
-import matplotlib.pyplot as plt
-from numpy.polynomial.chebyshev import chebfit, chebval
-
-from .io_results_loader import load_data, filter_data
-from .statistic import approximate_line, difference
-
-
-def linearity_table(data, types, vals):
-    """ create table by pyplot with diferences
-        between original and approximated
-        vals - values to make line"""
-    fields = 'blocksize_b', 'iops_mediana'
-    for tp in types:
-        filtered_data = filter_data('linearity_test_' + tp, fields)
-        # all values
-        x = []
-        y = []
-        # values to make line
-        ax = []
-        ay = []
-
-        for sz, med in sorted(filtered_data(data)):
-            iotime_ms = 1000. // med
-            x.append(sz / 1024.0)
-            y.append(iotime_ms)
-            if sz in vals:
-                ax.append(sz / 1024.0)
-                ay.append(iotime_ms)
-
-        ynew = approximate_line(ax, ay, x, True)
-
-        dif, _, _ = difference(y, ynew)
-        table_data = []
-        for i, d in zip(x, dif):
-            row = ["{0:.1f}".format(i), "{0:.1f}".format(d[0]), "{0:.0f}".format(d[1]*100)]
-            table_data.append(row)
-
-        tab = TT.Texttable()
-        tab.set_deco(tab.VLINES)
-
-        header = ["BlockSize, kB", "Absolute difference (ms)", "Relative difference (%)"]
-        tab.add_row(header)
-        tab.header = header
-
-        for row in table_data:
-            tab.add_row(row)
-
-        # uncomment to get table in pretty pictures :)
-        # colLabels = ("BlockSize, kB", "Absolute difference (ms)", "Relative difference (%)")
-        # fig = plt.figure()
-        # ax = fig.add_subplot(111)
-        # ax.axis('off')
-        # #do the table
-        # the_table = ax.table(cellText=table_data,
-        #           colLabels=colLabels,
-        #           loc='center')
-        # plt.savefig(tp+".png")
-
-
-def th_plot(data, tt):
-    fields = 'concurence', 'iops_mediana', 'lat_mediana'
-    conc_4k = filter_data('concurrence_test_' + tt, fields, blocksize='4k')
-    filtered_data = sorted(list(conc_4k(data)))
-
-    x, iops, lat = zip(*filtered_data)
-
-    _, ax1 = plt.subplots()
-
-    xnew = np.linspace(min(x), max(x), 50)
-    # plt.plot(xnew, power_smooth, 'b-', label='iops')
-    ax1.plot(x, iops, 'b*')
-
-    for degree in (3,):
-        c = chebfit(x, iops, degree)
-        vals = chebval(xnew, c)
-        ax1.plot(xnew, vals, 'g--')
-
-    # ax1.set_xlabel('thread count')
-    # ax1.set_ylabel('iops')
-
-    # ax2 = ax1.twinx()
-    # lat = [i / 1000 for i in lat]
-    # ax2.plot(x, lat, 'r*')
-
-    # tck = splrep(x, lat, s=0.0)
-    # power_smooth = splev(xnew, tck)
-    # ax2.plot(xnew, power_smooth, 'r-', label='lat')
-
-    # xp = xnew[0]
-    # yp = power_smooth[0]
-    # for _x, _y in zip(xnew[1:], power_smooth[1:]):
-    #     if _y >= 100:
-    #         xres = (_y - 100.) / (_y - yp) * (_x - xp) + xp
-    #         ax2.plot([xres, xres], [min(power_smooth), max(power_smooth)], 'g--')
-    #         break
-    #     xp = _x
-    #     yp = _y
-
-    # ax2.plot([min(x), max(x)], [20, 20], 'g--')
-    # ax2.plot([min(x), max(x)], [100, 100], 'g--')
-
-    # ax2.set_ylabel("lat ms")
-    # plt.legend(loc=2)
-
-
-def main(argv):
-    data = list(load_data(open(argv[1]).read()))
-    linearity_table(data, ["rwd", "rws", "rrd"], [4096, 4096*1024])
-    # linearity_plot(data, ["rwd", "rws", "rrd"])#, [4096, 4096*1024])
-    # linearity_plot(data, ["rws", "rwd"])
-    # th_plot(data, 'rws')
-    # th_plot(data, 'rrs')
-    plt.show()
-
-
-if __name__ == "__main__":
-    exit(main(sys.argv))
diff --git a/wally/report.py b/wally/report.py
index 2ab4664..ea8e943 100644
--- a/wally/report.py
+++ b/wally/report.py
@@ -1,4 +1,5 @@
 import os
+import math
 import bisect
 import logging
 
@@ -39,58 +40,67 @@
     return closure
 
 
-# def linearity_report(processed_results, path, lab_info):
-#     names = {}
-#     for tp1 in ('rand', 'seq'):
-#         for oper in ('read', 'write'):
-#             for sync in ('sync', 'direct', 'async'):
-#                 sq = (tp1, oper, sync)
-#                 name = "{0} {1} {2}".format(*sq)
-#                 names["".join(word[0] for word in sq)] = name
+def linearity_report(processed_results, path, lab_info):
+    names = {}
+    for tp1 in ('rand', 'seq'):
+        for oper in ('read', 'write'):
+            for sync in ('sync', 'direct', 'async'):
+                sq = (tp1, oper, sync)
+                name = "{0} {1} {2}".format(*sq)
+                names["".join(word[0] for word in sq)] = name
 
-#     colors = ['red', 'green', 'blue', 'cyan',
-#               'magenta', 'black', 'yellow', 'burlywood']
-#     markers = ['*', '^', 'x', 'o', '+', '.']
-#     color = 0
-#     marker = 0
+    colors = ['red', 'green', 'blue', 'cyan',
+              'magenta', 'black', 'yellow', 'burlywood']
+    markers = ['*', '^', 'x', 'o', '+', '.']
+    color = 0
+    marker = 0
 
-#     name_pref = 'linearity_test_'
-#     plot_data = []
+    plot_data = {}
 
-#     x = []
-#     y = []
-#     e = []
-#     # values to make line
-#     ax = []
-#     ay = []
+    name_pref = 'linearity_test_rrd'
 
-#     for res in processed_results.values():
-#         if res.name.startswith(name_pref):
-#             res
+    for res in processed_results.values():
+        if res.name.startswith(name_pref):
+            iotime = 1000000. / res.iops
+            iotime_max = iotime * (1 + res.dev * 3)
+            bsize = ssize_to_b(res.raw['blocksize'])
+            plot_data[bsize] = (iotime, iotime_max)
 
-#     for sz, med, dev in sorted(filtered_data(data)):
-#         iotime_ms = 1000. // med
-#         iotime_max = 1000. // (med - dev * 3)
+    min_sz = min(plot_data)
+    min_iotime, _ = plot_data.pop(min_sz)
 
-#         x.append(sz / 1024.0)
-#         y.append(iotime_ms)
-#         e.append(iotime_max - iotime_ms)
-#         if vals is None or sz in vals:
-#             ax.append(sz / 1024.0)
-#             ay.append(iotime_ms)
+    x = []
+    y = []
+    e = []
 
-#     plt.errorbar(x, y, e, linestyle='None', label=names[tp],
-#                  color=colors[color], ecolor="black",
-#                  marker=markers[marker])
-#     ynew = approximate_line(ax, ay, ax, True)
-#     plt.plot(ax, ynew, color=colors[color])
-#     color += 1
-#     marker += 1
-#     plt.legend(loc=2)
-#     plt.title("Linearity test by %i dots" % (len(vals)))
-# if plt:
-#     linearity_report = report('linearity',
-#    'linearity_test')(linearity_report)
+    for k, (v, vmax) in sorted(plot_data.items()):
+        # y.append(math.log10(v - min_iotime))
+        # x.append(math.log10(k))
+        # e.append(y[-1] - math.log10(vmax - min_iotime))
+        y.append(v - min_iotime)
+        x.append(k)
+        e.append(y[-1] - (vmax - min_iotime))
+
+    print e
+
+    tp = 'rrd'
+    plt.errorbar(x, y, e, linestyle='None', label=names[tp],
+                 color=colors[color], ecolor="black",
+                 marker=markers[marker])
+    plt.yscale('log')
+    plt.xscale('log')
+    plt.show()
+
+    # ynew = approximate_line(ax, ay, ax, True)
+    # plt.plot(ax, ynew, color=colors[color])
+    # color += 1
+    # marker += 1
+    # plt.legend(loc=2)
+    # plt.title("Linearity test by %i dots" % (len(vals)))
+
+
+if plt:
+    linearity_report = report('linearity', 'linearity_test')(linearity_report)
 
 
 def render_hdd_html(dest, info, lab_description):
@@ -288,14 +298,19 @@
 
 
 def make_io_report(results, path, lab_url=None, creds=None):
-    if lab_url is not None:
-        username, password, tenant_name = parse_creds(creds)
-        creds = {'username': username,
-                 'password': password,
-                 "tenant_name": tenant_name}
-        data = collect_lab_data(lab_url, creds)
-        lab_info = total_lab_info(data)
-    else:
+    lab_info = None
+    # if lab_url is not None:
+    #     username, password, tenant_name = parse_creds(creds)
+    #     creds = {'username': username,
+    #              'password': password,
+    #              "tenant_name": tenant_name}
+    #     try:
+    #         data = collect_lab_data(lab_url, creds)
+    #         lab_info = total_lab_info(data)
+    #     except Exception as exc:
+    #         logger.warning("Can't collect lab data: {0!s}".format(exc))
+
+    if lab_info is None:
         lab_info = {
             "total_disk": "None",
             "total_memory": "None",
diff --git a/wally/rest_api.py b/wally/rest_api.py
deleted file mode 100644
index fc9bd05..0000000
--- a/wally/rest_api.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import json
-import requests
-
-
-def add_test(test_name, test_data, url):
-    if not url.endswith("/"):
-        url += '/api/tests/' + test_name
-    requests.post(url=url, data=json.dumps(test_data))
-
-
-def get_test(test_name, url):
-    if not url.endswith("/"):
-        url += '/api/tests/' + test_name
-
-    result = requests.get(url=url)
-
-    return json.loads(result.content)
-
-
-def get_all_tests(url):
-    if not url.endswith('/'):
-        url += '/api/tests'
-
-    result = requests.get(url=url)
-    return json.loads(result.content)
diff --git a/wally/sensors.html b/wally/sensors/webui/sensors.html
similarity index 100%
rename from wally/sensors.html
rename to wally/sensors/webui/sensors.html
diff --git a/wally/suits/io/ceph.cfg b/wally/suits/io/ceph.cfg
index 9e98dd6..c9b2f53 100644
--- a/wally/suits/io/ceph.cfg
+++ b/wally/suits/io/ceph.cfg
@@ -12,8 +12,8 @@
 NUMJOBS_SHORT={% 1, 5, 10 %}
 
 size=30G
-ramp_time=30
-runtime=60
+ramp_time=5
+runtime=30
 
 # ---------------------------------------------------------------------
 # check different thread count, sync mode. (latency, iops) = func(th_count)
diff --git a/wally/suits/io/results_loader.py b/wally/suits/io/results_loader.py
index 102fe4c..4dff186 100644
--- a/wally/suits/io/results_loader.py
+++ b/wally/suits/io/results_loader.py
@@ -34,14 +34,9 @@
             assert len(results['bw']) % vm_count == 0
             block_count = len(results['bw']) // vm_count
 
-            # print
-            # print name, block_count
-            # print results['bw']
-            # print split_and_add(results['bw'], block_count)
-
             bw, bw_dev = med_dev(split_and_add(results['bw'], block_count))
-            iops, iops_dev = med_dev(split_and_add(results['iops'],
-                                                   block_count))
+            iops, _ = med_dev(split_and_add(results['iops'],
+                                            block_count))
             lat, lat_dev = med_dev(results['lat'])
             dev = bw_dev / float(bw)
             data[name] = PerfInfo(name, bw, iops, dev, lat, lat_dev, results,
diff --git a/wally/utils.py b/wally/utils.py
index 36601cd..8603f58 100644
--- a/wally/utils.py
+++ b/wally/utils.py
@@ -92,10 +92,10 @@
 
 def ssize_to_b(ssize):
     try:
-        ssize = ssize.lower()
+        if isinstance(ssize, (int, long)):
+            return ssize
 
-        if ssize.endswith("b"):
-            ssize = ssize[:-1]
+        ssize = ssize.lower()
         if ssize[-1] in SMAP:
             return int(ssize[:-1]) * SMAP[ssize[-1]]
         return int(ssize)