cpu_usage.py 文件源码

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

项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码
def update(self):
        a=0
        tot=0
        self.load.append(cpu_percent())
        for i in range(len(self.load)-1,len(self.load)):
            a=a+self.load[i]
            tot=tot+1.0
        a=a/tot
        self.load[len(self.load)-1]=a
        self.load.pop(0)

        try:        #user reported bug, This is a problem with the underlying function.
            w_temp=disk_io_counters()[3]/1000
        except:
            w_temp=0

        w_delta=w_temp-self.wait_last
        self.wait_last=w_temp

        self.wait.append(int(w_delta))
        #print(w_delta)
        self.wait.pop(0)

        self.color.append([255,0,0])
        self.color.pop(0)


        self.repaint()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号