# 获取CPU运行情况 def cpuInfo(): """ 获取CPU运行情况 :return: """ cpuTimes = psutil.cpu_times() # 获取CPU信息中的内存信息 def memoryInfo(memory): print(memory) """ 获取CPU信息中的内存信息 :param memory: :return: """ return { '总内存(total)': kmgt(memory.total), '已使用(used)': kmgt(memory.used), '空闲(free)': kmgt(memory.free), '使用率(percent)': str(memory.percent) + '%', '可用(available)': kmgt(memory.available) if hasattr(memory, 'available') else '', '活跃(active)': kmgt(memory.active) if hasattr(memory, 'active') else '', '非活跃(inactive)': kmgt(memory.inactive) if hasattr(memory, 'inactive') else '', '内核使用(wired)': kmgt(memory.wired) if hasattr(memory, 'wired') e
[原] Python 获取CPU信息
最新推荐文章于 2025-03-15 22:27:10 发布