def stop(cls): """ DECONSTRUCTS ANY LOGGING, AND RETURNS TO DIRECT-TO-stdout LOGGING EXECUTING MULUTIPLE TIMES IN A ROW IS SAFE, IT HAS NO NET EFFECT, IT STILL LOGS TO stdout :return: NOTHING """ from mo_threads import profiles if cls.cprofiler and hasattr(cls, "settings"): if cls.cprofiler == None: from mo_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 = StructuredLogger_usingStream(sys.stdout)
def stop(cls): from mo_logs import profiles if cls.cprofiler and hasattr(cls, "settings"): if cls.cprofiler == None: from mo_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 = StructuredLogger_usingStream(sys.stdout)
def stop(cls): from mo_logs import profiles if cls.cprofiler and hasattr(cls, "settings"): if cls.cprofiler == None: from mo_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 = StructuredLogger_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()