Пример #1
0
int GetProcessCPU_Idel()
{
    CpuUsage objCpu;

    int nCpuRoteBegin = objCpu.GetUsage();
    Sleep(1000);
    int nCpuRoteEnd = objCpu.GetUsage();

    return (int)((nCpuRoteEnd - nCpuRoteBegin) / 2);
}
Пример #2
0
DWORD WINAPI WatchItThreadProc(LPVOID lpParam)
{
	Sleep(500);
	while (true)
	{
		short cpuUsage = usage.GetUsage();

		printf("Thread id %d: %d%% cpu usage\n", ::GetCurrentThreadId(), cpuUsage);
		Sleep(1000);
	}
}