def start():
"""
Turn on profiling.
"""
global _profile_start, _profile_setup, _call_stack, _inst_data
if _profile_start is not None:
print("profiling is already active.")
return
if not _profile_setup:
setup() # just do a default setup
_profile_start = etime()
_call_stack.append(('$total', _profile_start, None))
if '$total' not in _inst_data:
_inst_data['$total'] = [None, 0., 0]
if sys.getprofile() is not None:
raise RuntimeError("another profile function is already active.")
sys.setprofile(_instance_profile_callback)
评论列表
文章目录