#include "kernel32.as"
#uselib "psapi.dll"
#func GetProcessMemoryInfo "GetProcessMemoryInfo" int,int,int
GetCurrentProcess
hProcess = stat
/*
struct PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
DWORD PeakWorkingSetSize;
DWORD WorkingSetSize;
DWORD QuotaPeakPagedPoolUsage;
DWORD QuotaPagedPoolUsage;
DWORD QuotaPeakNonPagedPoolUsage;
DWORD QuotaNonPagedPoolUsage;
DWORD PagefileUsage;
DWORD PeakPagefileUsage;
}
*/
alloc pmc, 40 //PROCESS_MEMORY_COUNTERS構造体
dupptr pmc`cb, varptr(pmc)+ 0, 4, vartype("int")
dupptr pmc`PageFaultCount, varptr(pmc)+ 4, 4, vartype("int")
dupptr pmc`PeakWorkingSetSize, varptr(pmc)+ 8, 4, vartype("int")
dupptr pmc`WorkingSetSize, varptr(pmc)+12, 4, vartype("int")
dupptr pmc`QuotaPeakPagedPoolUsage, varptr(pmc)+16, 4, vartype("int")
dupptr pmc`QuotaPeakNonPagedPoolUsage, varptr(pmc)+20, 4, vartype("int")
dupptr pmc`QuotaPeakNonPagedPoolUsage, varptr(pmc)+24, 4, vartype("int")
dupptr pmc`QuotaNonPagedPoolUsage, varptr(pmc)+28, 4, vartype("int")
dupptr pmc`PagefileUsage, varptr(pmc)+32, 4, vartype("int")
dupptr pmc`PeakPagefileUsage, varptr(pmc)+36, 4, vartype("int")
GetProcessMemoryInfo hProcess, varptr(pmc), 40
mes "PageFaultCount: " + pmc`PageFaultCount
mes "PeakWorkingSetSize: " + pmc`PeakWorkingSetSize
mes "WorkingSetSize: " + pmc`WorkingSetSize
mes "QuotaPeakPagedPoolUsage: " + pmc`QuotaPeakPagedPoolUsage
mes "QuotaPagedPoolUsage: " + pmc`QuotaPagedPoolUsage
mes "QuotaPeakNonPagedPoolUsage: " + pmc`QuotaPeakNonPagedPoolUsage
mes "QuotaNonPagedPoolUsage: " + pmc`QuotaNonPagedPoolUsage
mes "PagefileUsage: " + pmc`PagefileUsage
mes "PeakPagefileUsage: " + pmc`PeakPagefileUsage
http://msdn.microsoft.com/library/ja/jpperfmo/html/_win32_GetProcessMemoryInfo.asp?frame=true
http://msdn.microsoft.com/library/ja/jpdllpro/html/_win32_getcurrentprocess.asp?frame=true
どうやら、WorkingSetSizeが、タスクマネージャに表示されてる値と等しいみたいだね。