MCPcopy Index your code
hub / github.com/pythonprofilers/memory_profiler / run_module_with_profiler

Function run_module_with_profiler

memory_profiler.py:1258–1270  ·  view source on GitHub ↗
(module, profiler, backend, passed_args=[])

Source from the content-addressed store, hash-verified

1256
1257
1258def run_module_with_profiler(module, profiler, backend, passed_args=[]):
1259 from runpy import run_module
1260 builtins.__dict__['profile'] = profiler
1261 ns = dict(_CLEAN_GLOBALS, profile=profiler)
1262 _backend = choose_backend(backend)
1263 sys.argv = [module] + passed_args
1264 if _backend == 'tracemalloc' and has_tracemalloc:
1265 tracemalloc.start()
1266 try:
1267 run_module(module, run_name="__main__", init_globals=ns)
1268 finally:
1269 if has_tracemalloc and tracemalloc.is_tracing():
1270 tracemalloc.stop()
1271
1272
1273class LogFile(object):

Callers 1

memory_profiler.pyFile · 0.85

Calls 1

choose_backendFunction · 0.85

Tested by

no test coverage detected