standalone.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:hdlcc 作者: suoto 项目源码 文件源码
def main():
    "Main hook for standalone usage"
    start = time.time()
    runner_args = parseArguments()
    setupLogging(sys.stdout, runner_args.log_level)
    logging.root.setLevel(runner_args.log_level)
    #  logging.getLogger('hdlcc.source_file').setLevel(logging.WARNING)
    logging.getLogger('hdlcc.config_parser').setLevel(logging.WARNING)
    #  logging.getLogger('hdlcc.builders').setLevel(logging.INFO)
    logging.getLogger('vunit.project').setLevel(logging.ERROR)

    # Running hdlcc with threads has two major drawbacks:
    # 1) Makes interrupting it impossible currently because each source
    #    file is parsed on is own thread. Since there can be lots of
    #    sources, interrupting a single thread is not enough. This is
    #    discussed at https://github.com/suoto/hdlcc/issues/19
    # 2) When profiling, the result expected is of the inner hdlcc calls
    #    and with threads we have no info. This is discussed at
    #    https://github.com/suoto/hdlcc/issues/16
    # poor results (see suoto/hdlcc/issues/16).
    # To circumvent this we disable using threads at all when running
    # via standalone (it's ugly, I know)
    # pylint: disable=protected-access
    StandaloneProjectBuilder._USE_THREADS = False
    # pylint: enable=protected-access

    if runner_args.debug_profiling:
        profile.runctx(
            'runner(runner_args)',
            globals=globals(),
            locals={'runner_args' : runner_args},
            filename=runner_args.debug_profiling, sort=-1)
    else:
        runner(runner_args)
    end = time.time()
    _logger.info("Process took %.2fs", (end - start))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号