| 50 | |
| 51 | # Binding return struct from GlobalMemoryStatusEx |
| 52 | class MEMORYSTATUSEX(ctypes.Structure): |
| 53 | # dwLength should be set to the size of the struct |
| 54 | # dwMemoryLoad is in % |
| 55 | # The remaining members are in bytes |
| 56 | _fields_ = [ |
| 57 | ("dwLength", ctypes.c_ulong), |
| 58 | ("dwMemoryLoad", ctypes.c_ulong), |
| 59 | ("ullTotalPhys", ctypes.c_ulonglong), |
| 60 | ("ullAvailPhys", ctypes.c_ulonglong), |
| 61 | ("ullTotalPageFile", ctypes.c_ulonglong), |
| 62 | ("ullAvailPageFile", ctypes.c_ulonglong), |
| 63 | ("ullTotalVirtual", ctypes.c_ulonglong), |
| 64 | ("ullAvailVirtual", ctypes.c_ulonglong), |
| 65 | ("sullAvailExtendedVirtual", ctypes.c_ulonglong), |
| 66 | ] |
| 67 | |
| 68 | def __init__(self): |
| 69 | self.dwLength = ctypes.sizeof(self) |
| 70 | super(MEMORYSTATUSEX, self).__init__() |
| 71 | |
| 72 | stat = MEMORYSTATUSEX() |
| 73 | # TODO: add a try-except block |
no outgoing calls
no test coverage detected