Franck Freiburger
Franck Freiburger

Reputation: 28448

CPU load of the running process

I need to programmatically know (c/c++) what is the instant CPU load of the current running process. Win32 API offers a lot of low level API but I am unable to find one that gives me the current CPU load of my running c/c++ program.

The question is: how to programmatically know how many percents of CPU load the current process is using.

Upvotes: 2

Views: 876

Answers (2)

Eran
Eran

Reputation: 22020

You can use performance counters progrmatically. See Using Performance Counters and some example code.

Upvotes: 1

Justin
Justin

Reputation: 86729

You should be able to use perfmon to get the CPU use of any process by id - just look up the use for your process id.

Upvotes: 0

Related Questions