utils.py 文件源码

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

项目:mlens 作者: flennerhag 项目源码 文件源码
def _recorder(pid, stop, ival):
    """Subprocess call function to record cpu and memory."""
    t = t0 = time()

    process = psutil.Process(pid)

    if stop is None:
        while True:
            m = process.memory_info()
            print(psutil.cpu_percent(), ',', m[0], ',', m[1])
            sleep(ival)
            t = time()
    else:
        while t - t0 < stop:
            m = process.memory_info()
            print(psutil.cpu_percent(), ',', m[0], ',', m[1])
            sleep(ival)
            t = time()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号