tags:

views:

240

answers:

2

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.

A: 

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.

Kragen
+1  A: 

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

eran