mirror of
https://github.com/romanz/amodem.git
synced 2026-03-20 01:06:04 +08:00
15 lines
248 B
Python
15 lines
248 B
Python
import cProfile
|
|
import contextlib
|
|
|
|
|
|
@contextlib.contextmanager
|
|
def save(filename=None):
|
|
if filename:
|
|
pr = cProfile.Profile()
|
|
pr.enable()
|
|
yield
|
|
pr.disable()
|
|
pr.dump_stats(filename)
|
|
else:
|
|
yield
|