wince下的CPU和内存占用率计算

#include <Windows.h>
DWORD Caculation_CPU(LPVOID lpVoid)
{
MEMORYSTATUS MemoryInfo;
DWORD PercentIdle = ;
while()
{
DWORD dwStartTick = GetTickCount();
DWORD dwIdleSt = GetIdleTime();
Sleep();
DWORD dwStopTick = GetTickCount();
DWORD dwIdleEd = GetIdleTime();
PercentIdle = - ((*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));
GlobalMemoryStatus(&MemoryInfo); RETAILMSG(,(_T("dwTotalPhys = %d, dwAvailPhys = %d,dwAvailVirtual = %d, System CPU: Usage is %d%%\r\n!!"),MemoryInfo.dwTotalPhys, MemoryInfo.dwAvailPhys, MemoryInfo.dwAvailVirtual, PercentIdle));
}
return ;
} //创建一个线程来计算CPU和内存占用率
DWORD dwThreadID = 0;
CreateThread(NULL,,Caculation_CPU,,NULL,&dwThreadID);
上一篇:API安全验证之JWT(JSON WEB TOKEN) OLCMS


下一篇:IIS 301 重定向 带参数链接