本文整理匯總了Python中win32process.GetProcessMemoryInfo方法的典型用法代碼示例。如果您正苦於以下問題:Python win32process.GetProcessMemoryInfo方法的具體用法?Python win32process.GetProcessMemoryInfo怎麽用?Python win32process.GetProcessMemoryInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類win32process
的用法示例。
在下文中一共展示了win32process.GetProcessMemoryInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: memory
# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import GetProcessMemoryInfo [as 別名]
def memory():
process_handle = win32api.GetCurrentProcess()
memory_info = win32process.GetProcessMemoryInfo( process_handle )
return memory_info['PeakWorkingSetSize']
示例2: test_memory_info
# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import GetProcessMemoryInfo [as 別名]
def test_memory_info(self):
handle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION,
win32con.FALSE, self.pid)
self.addCleanup(win32api.CloseHandle, handle)
sys_value = win32process.GetProcessMemoryInfo(handle)
psutil_value = psutil.Process(self.pid).memory_info()
self.assertEqual(
sys_value['PeakWorkingSetSize'], psutil_value.peak_wset)
self.assertEqual(
sys_value['WorkingSetSize'], psutil_value.wset)
self.assertEqual(
sys_value['QuotaPeakPagedPoolUsage'], psutil_value.peak_paged_pool)
self.assertEqual(
sys_value['QuotaPagedPoolUsage'], psutil_value.paged_pool)
self.assertEqual(
sys_value['QuotaPeakNonPagedPoolUsage'],
psutil_value.peak_nonpaged_pool)
self.assertEqual(
sys_value['QuotaNonPagedPoolUsage'], psutil_value.nonpaged_pool)
self.assertEqual(
sys_value['PagefileUsage'], psutil_value.pagefile)
self.assertEqual(
sys_value['PeakPagefileUsage'], psutil_value.peak_pagefile)
self.assertEqual(psutil_value.rss, psutil_value.wset)
self.assertEqual(psutil_value.vms, psutil_value.pagefile)
示例3: update
# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import GetProcessMemoryInfo [as 別名]
def update(self):
process_handle = GetCurrentProcess()
meminfo = GetProcessMemoryInfo(process_handle)
memstatus = GlobalMemoryStatusEx()
self.vsz = memstatus['TotalVirtual'] - memstatus['AvailVirtual']
self.rss = meminfo['WorkingSetSize']
self.pagefaults = meminfo['PageFaultCount']
return True