當前位置: 首頁>>代碼示例>>Python>>正文


Python win32process.GetProcessMemoryInfo方法代碼示例

本文整理匯總了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'] 
開發者ID:Autodesk,項目名稱:arnold-usd,代碼行數:6,代碼來源:Debug.py

示例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) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:28,代碼來源:test_windows.py

示例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 
開發者ID:lrq3000,項目名稱:pyFileFixity,代碼行數:10,代碼來源:process.py


注:本文中的win32process.GetProcessMemoryInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。