kdanylov aka koder | 150b219 | 2017-04-01 16:53:01 +0300 | [diff] [blame^] | 1 | import numpy |
| 2 | |
| 3 | from cephlib.common import float2str |
| 4 | |
| 5 | from . import texttable |
| 6 | from .hlstorage import ResultStorage |
| 7 | from .stage import Stage, StepOrder |
| 8 | from .test_run_class import TestRun |
| 9 | from .suits.io.fio import FioTest |
| 10 | from .statistic import calc_norm_stat_props, calc_histo_stat_props |
| 11 | from .suits.io.fio_hist import get_lat_vals |
| 12 | |
| 13 | class 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()) |