E
E
Evgeny Zubkov2016-09-24 20:22:21
C++ / C#
Evgeny Zubkov, 2016-09-24 20:22:21

How to determine CPU usage using WINAPI?

Good day to all! The task is to write an analogue of the task manager with the ability to obtain information about the process (name, id, priority, CPU usage by a specific process, memory occupied by it). Can't get CPU usage at all. Is it possible to get such information using WinAPI?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
15432, 2016-09-24
@Yakamoz

GetProcessTimes to get the CPU time spent on a particular process
GetSystemTimes to get the total CPU usage info generally
call them twice with a delay of one second, find the difference and divide by the amount of elapsed time. something like this.
A similar example is here
stackoverflow.com/questions/23143693/retrieving-cp...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question