_cpu_utils.py 文件源码

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

项目:perf 作者: vstinner 项目源码 文件源码
def set_highest_priority():
    try:
        import psutil
    except ImportError:
        return

    proc = psutil.Process()
    if not hasattr(proc, 'nice'):
        return

    # Want to set realtime on Windows.
    # Fail hard for anything else right now, so it is obvious what to fix
    # when adding other OS support.
    try:
        proc.nice(psutil.REALTIME_PRIORITY_CLASS)
        return True
    except psutil.AccessDenied:
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号