MCPcopy
hub / github.com/treeverse/dvc / profile

Function profile

dvc/_debug.py:103–117  ·  view source on GitHub ↗

Run a cprofile

(dump_path: Optional[str] = None)

Source from the content-addressed store, hash-verified

101
102@contextmanager
103def profile(dump_path: Optional[str] = None):
104 """Run a cprofile"""
105 import cProfile
106
107 prof = cProfile.Profile()
108 prof.enable()
109
110 try:
111 yield
112 finally:
113 prof.disable()
114 if dump_path:
115 prof.dump_stats(dump_path)
116 else:
117 prof.print_stats(sort="cumtime")
118
119
120@contextmanager

Callers 1

debugtoolsFunction · 0.85

Calls 1

enableMethod · 0.80

Tested by

no test coverage detected