Page 1 of 1

Process CPU Time

Posted: Fri Jun 20, 2008 1:38 pm
by Mazinger
Hi,

I need to know the % CPU is using a process (like the taskbar).
How can I do it?

Thanks in advance.

Posted: Thu Jul 03, 2008 9:20 pm
by madshi
Hello,

sorry for the late reply.

There are 2 possibilities for doing this: You can get access to the OS's performance counters. That's quite ugly to do, but works. Alternatively you can use "GetProcessTimes" (or "IProcess.GetTimes"). Call this twice with a delay in between and then you can see the difference between the reported times and calculate the CPU consumption from that information.