# -*- coding: utf-8 -*-
from ctypes import *
import time
class MEMORYSTATUS(Structure):
while 1:
_fields_ = [(‘dwLength‘, c_int), (‘dwMemoryLoad‘, c_int), (‘dwTotalPhys‘, c_int), (‘dwAvailPhys‘, c_int), (‘dwTotalPageFile‘, c_int),
(‘dwAvailPageFile‘, c_int), (‘dwTotalVirtual‘, c_int), (‘dwAvailVirtual‘, c_int)]
time.sleep(1)
MEMORYSTATUS = MEMORYSTATUS()
windll.kernel32.GlobalMemoryStatus(byref(MEMORYSTATUS))
print ‘To use memory percentage:‘, MEMORYSTATUS.dwMemoryLoad#使用物理内存的百分比
print ‘Physical memory total:‘, MEMORYSTATUS.dwTotalPhys / (1024 * 1024)#物理内存总数
print ‘Physical memory available:‘, MEMORYSTATUS.dwAvailPhys / (1024 * 1024)
平时的笔记02:硬件信息
时间: 2024-10-31 00:16:02