das-research/study.py

36 lines
983 B
Python
Raw Normal View History

2022-11-30 14:28:27 +00:00
#! /bin/python3
import time
from DAS import *
def study():
sim = Simulator(0)
sim.initLogger()
2022-12-14 16:17:32 +00:00
maxTries = 10
step = 20
2022-11-30 14:28:27 +00:00
frRange = []
resultRange = []
simCnt = 0
sim.logger.info("Starting simulations:", extra=sim.format)
start = time.time()
for fr in range(0, 100, step):
if fr % 10 == 0:
sim.logger.info("Failure rate %d %% ..." % fr, extra=sim.format)
sim.resetFailureRate(fr)
result = 0
for i in range(maxTries):
sim.initValidators()
result += sim.run()
simCnt += 1
frRange.append(fr)
2022-12-14 16:17:32 +00:00
resultRange.append((maxTries-result)*100/maxTries)
2022-11-30 14:28:27 +00:00
end = time.time()
sim.logger.info("A total of %d simulations ran in %d seconds" % (simCnt, end-start), extra=sim.format)
for i in range(len(frRange)):
sim.logger.info("For failure rate of %d we got %d %% success rate in DAS!" % (frRange[i], resultRange[i]), extra=sim.format)
study()