On Tue, May 15, 2012 at 10:52 AM, Matt Anderson <[email protected]> wrote:
> I think this is what you want...after come cleanup. Test it on a 32 bit > http://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx > > I can put it in my clone if that's better > > def windows_memory_usage(): > """Return physical memory usage (float) > Works on Windows platforms only""" > from ctypes import windll > from ctypes.wintypes import byref, Structure, DWORD, sizeof > import ctypes > class MemoryStatus(Structure): > _fields_ = [('dwLength', ctypes.c_uint32), ('dwMemoryLoad', > ctypes.c_uint32), > ('dwlTotalPhys', ctypes.c_uint64), ('dwlAvailPhys', > ctypes.c_uint64), > ('dwlTotalPageFile', ctypes.c_uint64), > ('dwlAvailPageFile', ctypes.c_uint64), > ('dwlTotalVirtual', ctypes.c_uint64), > ('dwlAvailVirtual', ctypes.c_uint64), > ('dwlAvailExtendedVirtual', ctypes.c_uint64),] > memorystatus = MemoryStatus() > memorystatus.dwLength = sizeof(MemoryStatus) > windll.kernel32.GlobalMemoryStatusEx(byref(memorystatus)) > return float(memorystatus.dwMemoryLoad) > > No need to put it in the clone. This is perfect. Thanks for coming up with a fix! I'll do a little cleanup and submit it for pull to the main repo later today. -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
