python利用wmi统计windows下内存信息
2012-09-03 14:02
591 查看
# -*- coding: utf-8 -*-
#import
########################################################################
import os, sys
import time
import wmi
########################################################################
#function
########################################################################
def get_memory_info():
tmpdict = {}
c = wmi.WMI ()
cs = c.Win32_ComputerSystem()
os = c.Win32_OperatingSystem()
pfu = c.Win32_PageFileUsage()
tmpdict["MemTotal"] = int(cs[0].TotalPhysicalMemory)/1024/1024
tmpdict["MemFree"] = int(os[0].FreePhysicalMemory)/1024
tmpdict["SwapTotal"] = int(pfu[0].AllocatedBaseSize)
tmpdict["SwapFree"] = int(pfu[0].AllocatedBaseSize - pfu[0].CurrentUsage)
return tmpdict
if __name__ == "__main__":
print get_memory_info()其他python网站访问地址:http://bbs.pythonfan.org/thread-2349-1-1.html本文出自 “学海无涯苦作伴” 博客,请务必保留此出处http://linuxshow.blog.51cto.com/1572053/980644
#import
########################################################################
import os, sys
import time
import wmi
########################################################################
#function
########################################################################
def get_memory_info():
tmpdict = {}
c = wmi.WMI ()
cs = c.Win32_ComputerSystem()
os = c.Win32_OperatingSystem()
pfu = c.Win32_PageFileUsage()
tmpdict["MemTotal"] = int(cs[0].TotalPhysicalMemory)/1024/1024
tmpdict["MemFree"] = int(os[0].FreePhysicalMemory)/1024
tmpdict["SwapTotal"] = int(pfu[0].AllocatedBaseSize)
tmpdict["SwapFree"] = int(pfu[0].AllocatedBaseSize - pfu[0].CurrentUsage)
return tmpdict
if __name__ == "__main__":
print get_memory_info()其他python网站访问地址:http://bbs.pythonfan.org/thread-2349-1-1.html本文出自 “学海无涯苦作伴” 博客,请务必保留此出处http://linuxshow.blog.51cto.com/1572053/980644
相关文章推荐
- python利用wmi模块统计windows下硬盘信息
- python利用wmi模块统计windows下网卡信息和连接数
- python利用WMI等监控获取windows状态如CPU、内存、硬盘等信息
- python利用WMI监控windows状态如CPU、内存、硬盘
- 利用python 与 wmi 获取WINDOWS基本信息
- Python 利用WMI监控windows状态如CPU、内存、硬盘
- python利用wmi模块统计windows下cpu信息
- python使用wmi模块获取windows下硬盘信息的方法
- 利用Python脚本获取Windows和Linux的系统版本信息 推荐
- python使用WMI检测windows系统信息、硬盘信息、网卡信息的方法
- Python WMI获取Windows系统信息 监控系统
- python利用platform模块获取windows系统信息
- Python用WMI模块获取Windows系统的硬件信息
- c#中利用WMI对象获取物理内存和可用内存大小信息
- c#中利用WMI对象获取物理内存和可用内存大小信息
- python使用WMI检测windows系统信息、硬盘信息、网卡信息的方法
- Python WMI获取Windows系统信息 监控系统
- python使用wmi模块获取windows下的系统信息 监控系统
- 利用python提取vc output中的内存泄漏统计信息
- Python3.5 Windows 7下 利用百度识图来获得图片信息