| import numpy |
| |
| from cephlib.common import float2str |
| |
| from . import texttable |
| from .hlstorage import ResultStorage |
| from .stage import Stage, StepOrder |
| from .test_run_class import TestRun |
| from .suits.io.fio import FioTest |
| from .statistic import calc_norm_stat_props, calc_histo_stat_props |
| from .suits.io.fio_hist import get_lat_vals |
| |
| class ConsoleReportStage(Stage): |
| |
| priority = StepOrder.REPORT |
| |
| def run(self, ctx: TestRun) -> None: |
| rstorage = ResultStorage(ctx.storage) |
| for suite in rstorage.iter_suite(FioTest.name): |
| table = texttable.Texttable(max_width=200) |
| |
| table.header(["Description", "IOPS ~ Dev", "BW, MiBps", 'Skew/Kurt', 'lat med, ms', 'lat 95, ms']) |
| table.set_cols_align(('l', 'r', 'r', 'r', 'r', 'r')) |
| |
| for job in sorted(rstorage.iter_job(suite), key=lambda job: job.params): |
| bw_ts, = list(rstorage.iter_ts(suite, job, metric='bw')) |
| props = calc_norm_stat_props(bw_ts) |
| avg_iops = props.average // job.params.params['bsize'] |
| iops_dev = props.deviation // job.params.params['bsize'] |
| |
| lat_ts, = list(rstorage.iter_ts(suite, job, metric='lat')) |
| bins_edges = numpy.array(get_lat_vals(lat_ts.data.shape[1]), dtype='float32') / 1000 # convert us to ms |
| lat_props = calc_histo_stat_props(lat_ts, bins_edges) |
| table.add_row([job.params.summary, |
| "{} ~ {}".format(float2str(avg_iops), float2str(iops_dev)), |
| float2str(props.average / 1024), # Ki -> Mi |
| "{}/{}".format(float2str(props.skew), float2str(props.kurt)), |
| float2str(lat_props.perc_50), float2str(lat_props.perc_95)]) |
| |
| print(table.draw()) |