|
楼主 |
发表于 2012-3-14 11:46:41
|
显示全部楼层
GetProcessMemoryInfo = ::Psapi.api("GetProcessMemoryInfo","int(pointer hProcess,struct& ppsmemCounters,int cb)")
PROCESS_MEMORY_COUNTERS= class{
int cb;
int PageFaultCount;
int PeakWorkingSetSize; //物理内存的最大值
int WorkingSetSize; //物理内存的大小
int QuotaPeakPagedPoolUsage;
int QuotaPagedPoolUsage;
int QuotaPeakNonPagedPoolUsage;
int QuotaNonPagedPoolUsage;
int PagefileUsage; //虚拟内存大小
int PeakPagefileUsage; //虚拟内存的最大值
}
mem=PROCESS_MEMORY_COUNTERS()
io.print(raw.sizeof(mem));
for processEntry in process.each( ".*.exe" ) {
io.print(processEntry.th32ProcessID);
prc=process(processEntry.th32ProcessID)
io.print(prc);
GetProcessMemoryInfo(prc.handle,mem,raw.sizeof(mem))
io.print(processEntry.szExeFile + " 内存使用:",mem.WorkingSetSize/1024 ++ "K")
}
前面不好意思,不过这个还是null,就是中间输出的那个prc |
|