Ejemplo n.º 1
0
def do_expr_parsed():
    model = ModelFactory.get_parsed()
    checker = Checker(model=model, ltl=ltl, duration=TIME_LIMIT_IN_DAYS*2)
    # wrapper = ExperimentWrapper(checker, samples_per_param=SAMPLES_PER_PARAM)
    wrapper = ExperimentWrapper(checker)
    wrapper.setconstants([thickness_cnsts,])
    logger.info("Parsed model expr began.")
    result = wrapper.do_expe()
    logger.info("Parsed model expr end.")
    return result
Ejemplo n.º 2
0
def test_parsed():
    parsed = ModelFactory.get_parsed()
    parsed.prepareCommands()
    pr = cProfile.Profile()
    pr.enable()
    result, path = parsed.gen_random_path(duration=duration)
    pr.disable()
    print "len of path:{}".format(len(path))
    s = StringIO.StringIO()
    sortby = "cumulative"
    ps = pstats.Stats(pr, stream=io.FileIO("./parsed",
                                           mode='w')).sort_stats(sortby)
    ps.print_stats()
    print s.getvalue()
Ejemplo n.º 3
0
def test_parsed(parsed=None):
    if not parsed:
        parsed = ModelFactory.get_parsed()
        parsed.duration = duration
        parsed.prepare()
    # thd = StepGenThd(model=parsed)
    # thd.setDaemon(True)
    # thd.start()
    # time.sleep(2)  # 模拟用户输入
    pr = cProfile.Profile()
    pr.enable()
    path = parsed.get_random_path_V2()
    pr.disable()
    print "len of path:{}".format(len(path))
    s = StringIO.StringIO()
    sortby = "cumulative"
    ps = pstats.Stats(pr, stream=io.FileIO("./parsed",
                                           mode='w')).sort_stats(sortby)
    ps.print_stats()
    print s.getvalue()
Ejemplo n.º 4
0
def getParsedModel():
    return ModelFactory.get_parsed()
Ejemplo n.º 5
0
 def setUp(self):
     self.parsed = ModelFactory.get_parsed()
     self.ltl = ["U[1, {}]".format(DURATION), "T", "failure"]
     self.checker = Checker(self.parsed, ltl=self.ltl, duration=DURATION)
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
from model.ModelFactory import ModelFactory
from util.AnnotationHelper import profileit

model = ModelFactory.get_parsed(duration=1000000)
model.prepare()


#  测试将队列填满需要多少时间
@profileit("stepgentime")
def test():
    step_gen = model.gen_next_step(passed_time=0.0)
    for _ in range(73000):
        step = next(step_gen)
        model.steps_queue.append(step)


if __name__ == "__main__":
    test()