PythonUtil.py 文件源码

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

项目:POTCO-PS 作者: ksmit799 项目源码 文件源码
def startProfile(filename=PyUtilProfileDefaultFilename,
                 lines=PyUtilProfileDefaultLines,
                 sorts=PyUtilProfileDefaultSorts,
                 silent=0,
                 callInfo=1,
                 useDisk=False,
                 cmd='run()'):
    # uniquify the filename to allow multiple processes to profile simultaneously
    filename = '%s.%s%s' % (filename, randUint31(), randUint31())
    if not useDisk:
        # use a RAM file
        _installProfileCustomFuncs(filename)
    _profileWithoutGarbageLeak(cmd, filename)
    if silent:
        extractProfile(filename, lines, sorts, callInfo)
    else:
        printProfile(filename, lines, sorts, callInfo)
    if not useDisk:
        # discard the RAM file
        _removeProfileCustomFuncs(filename)
    else:
        os.remove(filename)

# call these to see the results again, as a string or in the log
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号