术语 | getprocessworkingsetsize |
释义 | GetProcessWorkingSetSize 语法: C++ BOOL WINAPI GetProcessWorkingSetSize( __in HANDLE hProcess, __out PSIZE_T lpMinimumWorkingSetSize, __out PSIZE_T lpMaximumWorkingSetSize ); GetProcessWorkingSetSize功能 检索的最小和最大工作集大小指定的进程。 参数 hProcess [in] 一个句柄,的工作集大小将得到处理。句柄必须有PROCESS_QUERY_INFORMATION或PROCESS_QUERY_LIMITED_INFORMATION访问权限。有关更多信息,请参见过程的安全性和访问权限。 Windows Server 2003和Windows XP/2000操作系统:在处理必须有PROCESS_QUERY_INFORMATION访问权。 lpMinimumWorkingSetSize [out] 一个变量,它接收的最低工作集的指明工序大小,以字节的指针。虚拟内存管理器试图至少保持这一进程的内存居民每当进程处于活动状态。 lpMaximumWorkingSetSize [out] 一个变量,它接收的最大工作集的指明工序大小,以字节的指针。虚拟内存管理器试图将没有比这个过程中更多的内存居民每当进程处于活动状态时,内存供不应求。 返回值 如果函数成功,返回值为非零。 如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。 备注 “工作设置一个过程”是的内存页目前可以看到的物理RAM内存设置过程。这些网页的居民,可供应用程序使用,而不会触发页面错误。最小和最大工作集大小影响的虚拟内存分页行为的过程。 实例 #include #include #include int main(int argc, char *argv[]) { SIZE_T dwMin, dwMax; HANDLE hProcess; if (argc != 2) { printf("This program requires a process ID as an argument.\\n"); return 1; } // Retrieve a handle to the process. hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, atoi(argv[1])); if (!hProcess) { printf( "OpenProcess failed (%d)\\n", GetLastError() ); return 1; } // Retrieve the working set size of the process. if (!GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax)) { printf("GetProcessWorkingSetSize failed (%d)\\n", GetLastError()); return 1; } printf("Process ID: %d\\n", atoi(argv[1])); printf("Minimum working set: %lu Kbytes\\n", dwMin/1024); printf("Maximum working set: %lu Kbytes\\n", dwMax/1024); CloseHandle(hProcess); return 0; } 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 工艺工作集 过程 SetProcessWorkingSetSize 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==GetProcessWorkingSetSize Function Retrieves the minimum and maximum working set sizes of the specified process. Syntax C++ BOOL WINAPI GetProcessWorkingSetSize( __in HANDLE hProcess, __out PSIZE_T lpMinimumWorkingSetSize, __out PSIZE_T lpMaximumWorkingSetSize ); Parameters hProcess [in] A handle to the process whose working set sizes will be obtained. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights . Windows Server 2003 and Windows XP/2000: The handle must have the PROCESS_QUERY_INFORMATION access right. lpMinimumWorkingSetSize [out] A pointer to a variable that receives the minimum working set size of the specified process, in bytes. The virtual memory manager attempts to keep at least this much memory resident in the process whenever the process is active. lpMaximumWorkingSetSize [out] A pointer to a variable that receives the maximum working set size of the specified process, in bytes. The virtual memory manager attempts to keep no more than this much memory resident in the process whenever the process is active when memory is in short supply. Return Value If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError . Remarks The "working set" of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault. The minimum and maximum working set sizes affect the virtual memory paging behavior of a process. Examples #include #include #include int main(int argc, char *argv[]) { SIZE_T dwMin, dwMax; HANDLE hProcess; if (argc != 2) { printf("This program requires a process ID as an argument.\\n"); return 1; } // Retrieve a handle to the process. hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, atoi(argv[1])); if (!hProcess) { printf( "OpenProcess failed (%d)\\n", GetLastError() ); return 1; } // Retrieve the working set size of the process. if (!GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax)) { printf("GetProcessWorkingSetSize failed (%d)\\n", GetLastError()); return 1; } printf("Process ID: %d\\n", atoi(argv[1])); printf("Minimum working set: %lu Kbytes\\n", dwMin/1024); printf("Maximum working set: %lu Kbytes\\n", dwMax/1024); CloseHandle(hProcess); return 0; } Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinbase.h (include Windows.h) LibraryKernel32.lib DLLKernel32.dll See Also Process Working Set Processes SetProcessWorkingSetSize Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/ms683226(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。