def stress(profiling, profiling_dump, verbose): loglevel = { 0: logging.INFO, 1: logging.DEBUG } coloredlogs.install(level=loglevel.get(verbose, logging.INFO), fmt='%(asctime)s.%(msecs)03d %(name)s[%(process)d] %(levelname)s %(message)s') test = Test() if profiling: profile(print_stats=25, dump_stats=profiling_dump)(test.run)() else: test.run()
def main(): from sys import argv if "--profile" in argv: try: from profilestats import profile to_run = profile(real_main) except: print dedent(""" ####### Profilestats had a problem. Did you install it? Are you in the right environment? See the mcviz/utils/bootstrap_extenv.sh and source mcviz/utils/extenv/bin/activate #######""").strip() raise else: to_run = real_main return to_run(argv)