flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > 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: 343
CPU usage what's better Win api function for this ?
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.