I need know how my program CPU usage for Windows 7.
Enough for one core CPU.
I read about NtQuerySystemInformation and GetSystemTimes.
In all cases need formula:
BYTE cpuusage = (BYTE) (100 - (((spi[cpuloopcount].IdleTime.QuadPart - spi_old[cpuloopcount].IdleTime.QuadPart) * 100) / \
((spi[cpuloopcount].KernelTime.QuadPart + spi[cpuloopcount].UserTime.QuadPart) - (spi_old[cpuloopcount].KernelTime.QuadPart + spi_old[cpuloopcount].UserTime.QuadPart))));
How find time for Kernel and User ? Get from function GetProcessTimes ?
PS: Where is found for fasm simple sample CPU usage ?
|