iprofile.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:OpenMDAO 作者: OpenMDAO 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号