app.py 文件源码

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

项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码
def runWithProfiler(reactor, config):
    """Run reactor under standard profiler."""
    try:
        import profile
    except ImportError, e:
        s = "Failed to import module profile: %s" % e
        s += """
This is most likely caused by your operating system not including
profile.py due to it being non-free. Either do not use the option
--profile, or install profile.py; your operating system vendor
may provide it in a separate package.
"""
        traceback.print_exc(file=log.logfile)
        log.msg(s)
        log.deferr()
        sys.exit('\n' + s + '\n')

    p = profile.Profile()
    p.runcall(reactor.run)
    if config['savestats']:
        p.dump_stats(config['profile'])
    else:
        # XXX - omfg python sucks
        tmp, sys.stdout = sys.stdout, open(config['profile'], 'a')
        p.print_stats()
        sys.stdout, tmp = tmp, sys.stdout
        tmp.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号