本文整理汇总了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