def stop(cls): from pyLibrary.debugs import profiles if cls.cprofiler and hasattr(cls, "settings"): import pstats cls.cprofiler_stats.add(pstats.Stats(cls.cprofiler)) write_profile(cls.settings.cprofile, cls.cprofiler_stats.pop_all()) if profiles.ON and hasattr(cls, "settings"): profiles.write(cls.settings.profile) cls.main_log.stop() cls.main_log = TextLog_usingStream(sys.stdout)
def stop(cls): from pyLibrary.debugs import profiles if cls.cprofiler and hasattr(cls, "settings"): if cls.cprofiler == None: from pyLibrary.thread.threads import Queue cls.cprofiler_stats = Queue("cprofiler stats") # ACCUMULATION OF STATS FROM ALL THREADS import pstats cls.cprofiler_stats.add(pstats.Stats(cls.cprofiler)) write_profile(cls.settings.cprofile, cls.cprofiler_stats.pop_all()) if profiles.ON and hasattr(cls, "settings"): profiles.write(cls.settings.profile) cls.main_log.stop() cls.main_log = TextLog_usingStream(sys.stdout)
for i in range(NUM_REPEAT): results = [] gc.collect() with Profiler("more string: slow_wrap"): for v in inputs: results.append(slow_wrap(v)) results = [] gc.collect() with Profiler("more string: wrap"): for v in inputs: results.append(wrap(v)) results = [] gc.collect() with Profiler("more string: baseline"): for v in inputs: results.append(baseline(v)) Log.note("Done {{i}} of {{num}}", {"i": i, "num": NUM_REPEAT}) profiles.ON = True Log.start() test_wrap_1() test_wrap_2() test_wrap_3() profiles.write(Data(filename="speedtest_wrap.tab")) Log.stop()