In this article, you will find a solution for getting CPU usage with the help of GetSystemTimes.
|
// GetCPU.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "cpu.h"
int _tmain(int argc, _TCHAR* argv[])
{
CPU cpu;
int sys;
int process;
TKTime upTime;
for( ;; )
{
Sleep( 200 );
process = cpu.GetUsage( &sys, &upTime );
wprintf( _T("Process : %d\tSystem : %d\n"), process, sys );
}
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.