__init__.py 文件源码

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

项目:sonic-snmpagent 作者: Azure 项目源码 文件源码
def __init__(self):
        super().__init__()
        # From the psutil documentation https://pythonhosted.org/psutil/#psutil.cpu_percent:
        #
        #    Warning the first time this function is called
        #    with interval = 0.0 or None it will return a
        #    meaningless 0.0 value which you are supposed
        #    to ignore.
        psutil.cpu_percent()
        # '...is recommended for accuracy that this function be called with at least 0.1 seconds between calls.'
        time.sleep(0.1)
        # a sliding window of 60 contiguous 5 sec utilization (up to five minutes)
        self.cpuutils = collections.deque([psutil.cpu_percent()], maxlen=60)
        self.system_virtual_memory = psutil.virtual_memory()

        logger.debug('System Utilization handler initialized.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号