blob: bfa8881ca2ee63117a0bf48327891882047d759b [file] [log] [blame]
kdanylov aka koder150b2192017-04-01 16:53:01 +03001import numpy
2
3from cephlib.common import float2str
4
5from . import texttable
6from .hlstorage import ResultStorage
7from .stage import Stage, StepOrder
8from .test_run_class import TestRun
9from .suits.io.fio import FioTest
10from .statistic import calc_norm_stat_props, calc_histo_stat_props
11from .suits.io.fio_hist import get_lat_vals
12
13class ConsoleReportStage(Stage):
14
15 priority = StepOrder.REPORT
16
17 def run(self, ctx: TestRun) -> None:
18 rstorage = ResultStorage(ctx.storage)
19 for suite in rstorage.iter_suite(FioTest.name):
20 table = texttable.Texttable(max_width=200)
21
22 table.header(["Description", "IOPS ~ Dev", 'Skew/Kurt', 'lat med', 'lat 95'])
23 table.set_cols_align(('l', 'r', 'r', 'r', 'r'))
24
25 for job in sorted(rstorage.iter_job(suite), key=lambda job: job.params):
26 bw_ts, = list(rstorage.iter_ts(suite, job, metric='bw'))
27 props = calc_norm_stat_props(bw_ts)
28 avg_iops = props.average // job.params.params['bsize']
29 iops_dev = props.deviation // job.params.params['bsize']
30
31 lat_ts, = list(rstorage.iter_ts(suite, job, metric='lat'))
32 bins_edges = numpy.array(get_lat_vals(lat_ts.data.shape[1]), dtype='float32') / 1000 # convert us to ms
33 lat_props = calc_histo_stat_props(lat_ts, bins_edges)
34
35 table.add_row([job.params.summary,
36 "{} ~ {}".format(float2str(avg_iops), float2str(iops_dev)),
37 "{}/{}".format(float2str(props.skew), float2str(props.kurt)),
38 float2str(lat_props.perc_50), float2str(lat_props.perc_95)])
39
40 print(table.draw())