blob: 0e8cb1cd3047210b228db97c8c5f53d7fed9c08b [file] [log] [blame]
koder aka kdanilov7f59d562016-12-26 01:34:23 +02001# put all result preprocessing here
2# selection, aggregation
koder aka kdanilovffaf48d2016-12-27 02:25:29 +02003
4from .stage import Stage, StepOrder
5from .test_run_class import TestRun
6from .statistic import calc_norm_stat_props, NormStatProps
7from .result_classes import NormStatProps
8
9class CalcStatisticStage(Stage):
10 priority = StepOrder.TEST + 1
11
12 def run(self, ctx: TestRun) -> None:
13 results = {}
14
15 for is_file, name in ctx.storage.list("result"):
16 if is_file:
17 continue
18
19 path = "result/{}".format(name)
20 info = ctx.storage.get("result/{}/info".format(name))
21
22 if info['test'] == 'fio':
23 for node in info['nodes']:
24 data_path = "{}/measurement/{}".format(path, node)
25
26 iops = ctx.storage.get_array('Q', data_path, 'iops_data')
27 iops_stat_path = "{}/iops_stat".format(data_path)
28 if iops_stat_path in ctx.storage:
29 iops_stat= ctx.storage.load(NormStatProps, iops_stat_path)
30 else:
31 iops_stat = calc_norm_stat_props(iops)
32 ctx.storage.put(iops_stat, iops_stat_path)
33
34 bw = ctx.storage.get_array('Q', data_path, 'bw_data')
35 bw_stat_path = "{}/bw_stat".format(data_path)
36 if bw_stat_path in ctx.storage:
37 bw_stat = ctx.storage.load(NormStatProps, bw_stat_path)
38 else:
39 bw_stat = calc_norm_stat_props(bw)
40 ctx.storage.put(bw_stat, bw_stat_path)
41
42 lat = ctx.storage.get_array('L', data_path, 'lat_data')
43 lat_stat = None
44
45 results[name] = (iops, iops_stat, bw, bw_stat, lat, lat_stat)
46
47 for name, (iops, iops_stat, bw, bw_stat, lat, lat_stat) in results.items():
48 print(" ------------------- IOPS -------------------")
49 print(iops_stat) # type: ignore
50 print(" ------------------- BW -------------------")
51 print(bw_stat) # type: ignore
52 # print(" ------------------- LAT -------------------")
53 # print(calc_stat_props(lat))