flat assembler
Message board for the users of flat assembler.

Index > Windows > CPU usage what's better Win api function for this ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1818
Roman 27 Oct 2016, 05:06
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 ?
Post 27 Oct 2016, 05:06
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.