[Python Study Notes]cpu信息

‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
>>文件: cpu信息.py
>>作者: liu yang
>>邮箱: [email protected]

‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys,os

import psutil
from cpu使用率 import cpu_utilization

def cpu_message():
    # 总核心数=物理处理器x每个处理器的核心数
    cpu_count=psutil.cpu_count()
    # 物理核心数,处理器数量
    cpu_count_p=psutil.cpu_count(False)
    # cpu频率  scpufreq(current=1792.0, min=0.0, max=1992.0)
    cpu_freq=psutil.cpu_freq()
    # 当前处理器单核最高频率
    cpu_freq_max=cpu_freq.max
    # 目前单核处理器频率
    cpu_freq_current=cpu_freq.current
    # cpu使用率
    cpu_used_percent=cpu_utilization()
    print("总核心数:%s    物理核心数:%s    cpu最大频率:%sHz    cpu当前频率:%sHz    cpu使用率:%0.2f"%(cpu_count,cpu_count_p,cpu_freq_max,cpu_freq_current,cpu_used_percent))

if __name__ == ‘__main__‘:

    while True:
        cpu_message()
        # os.system("cls")

原文地址:https://www.cnblogs.com/liu66blog/p/8450060.html

时间: 2024-10-29 00:06:38

[Python Study Notes]cpu信息的相关文章

[Python Study Notes]内存信息

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: 内存信息.py >>作者: liu yang >>邮箱: [email protected] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Python Study Notes]电池信息

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: 电池信息.py >>作者: liu yang >>邮箱: [email protected] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Python Study Notes]进程信息(丁丁软件监控进程,http-post)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: 进程信息.py >>作者: liu yang >>邮箱: [email protected] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Python Study Notes]CS架构远程访问获取信息--SERVER端

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: ps_server.py >>作者: liu yang >>邮箱: [email protected] '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Python Study Notes] psutil模块

系统性能信息模块psutil psutil是一个跨平台库,能够轻松实现获取系统运行的进程和系统利用率(CPU,内存,磁盘,网络等)信息,主要应用于系统监控,分析和限制系统资源及进程的管理,它实现了同等命令行工具提供的功能,如ps,top,lsof,netstat,ifconfig,who,df,kill,free,nice等.支持32位,和64位的Linux,Windows,OS X,FreeBSD等操作系统. 获取系统性能信息 1 1 cpu信息 2 #Linux系统cpu利用率有以下几个部分

[Python Study Notes]CS架构远程访问获取信息--SERVER端v2.0

更新内容: 1.增加内存信息获取 2.增加电池信息获取 3.增加磁盘信息获取 4.重新布局窗体 5.增加窗体名称 6.增加连接成功之前,不可按压 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: ps_server.py >>作者: liu yang >>邮箱: [email protected] >&g

[Python Study Notes]CS架构远程访问获取信息--Client端v2.0

更新内容: 1.增加内存信息获取 2.增加电池信息获取 3.增加磁盘信息获取 4.重新布局窗体 5.增加窗体名称 6.增加连接成功之前,不可按压 效果图: ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: ps_client.py >>作者: liu yang >>邮箱: [email protected] &

[Python Study Notes]计算cpu使用率

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: cpu使用率.py >>作者: liu yang >>邮箱: [email protected] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Python Study Notes]计算cpu使用率v0.1

V0.1 更新日志: 1.加入平台判断,支持windows与linux 2.自动清屏显示,显示更加直观 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>文件: cpu使用率.py >>作者: liu yang >>邮箱: [email protected] ''''''''''''''''''''''''''''''