Created
April 23, 2018 05:36
-
-
Save yamahigashi/b025c053922de5b28d823d891765c252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ctypes | |
| class MEMORYSTATUSEX(ctypes.Structure): | |
| _fields_ = [ | |
| ('dwLength', ctypes.c_ulong), | |
| ('dwMemoryLoad', ctypes.c_ulong), | |
| ('ullTotalPhys', ctypes.c_ulonglong), | |
| ('ullAvailPhys', ctypes.c_ulonglong), | |
| ('ullTotalPageFile', ctypes.c_ulonglong), | |
| ('ullAvailPageFile', ctypes.c_ulonglong), | |
| ('ullTotalVirtual', ctypes.c_ulonglong), | |
| ('ullAvailVirtual', ctypes.c_ulonglong), | |
| ('ullAvailExtendedVirtual', ctypes.c_ulonglong) | |
| ] | |
| info = MEMORYSTATUSEX() | |
| info.dwLength = ctypes.sizeof(info) | |
| ctypes.windll.kernel32.GlobalMemoryStatusEx(info) | |
| print(info.ullTotalPhys/2**30) | |
| print(info.ullAvailPhys/2**30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment